Hi All
I have a scenario where I need capture FileName, File Created Date and file size in to a sql table. I was able to use a script component. But unfortunately the file creation time is not the actual file created date but its capturing the modified date.
Consider a file was created on source folder at 2.30 PM and I copied the file to target folder at 2.45 Pm , My code is pulling up the copied timestamp not the actual file created time stamp. Below is the code , Can you please how do I capture the actual creation date
{
SqlConnection myADONETConnection = new SqlConnection();
myADONETConnection = (SqlConnection)(Dts.Connections["GetFileInfo_Target"].AcquireConnection(Dts.Transaction) as SqlConnection);
//MessageBox.Show(myADONETConnection.ConnectionString, "ADO.NET Connection");
//get all files from directory
string[] files = Directory.GetFiles(DirPath);
SqlCommand sqlCmd= new SqlCommand();
sqlCmd.Connection = myADONETConnection;
foreach (string filename in files)
{
file.Name + "','" + file.CreationTime + "','" + file.Length + "')";
//MessageBox.Show(sqlCmd.CommandText);
}
Dts.TaskResult = (int)ScriptResults.Success;