Skip to content

Instantly share code, notes, and snippets.

@tdmitch
Last active July 11, 2021 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdmitch/db9531e7e2510b009e46fdc80765665c to your computer and use it in GitHub Desktop.
Save tdmitch/db9531e7e2510b009e46fdc80765665c to your computer and use it in GitHub Desktop.
public void Main()
{
// Create a logical file object
System.IO.FileInfo theFile = new System.IO.FileInfo(Dts.Variables["vFilename"].Value.ToString());
// If the update date on the file is greater than the date specified in the MinDateStamp
// variable, set the variable flag to process the file.
if (theFile.Exists
&& theFile.LastWriteTime > DateTime.Parse(Dts.Variables["pMinDateStamp"].Value.ToString()))
{
Dts.Variables["vProcessFile"].Value = true;
// Log the processed file
bool fireAgain = false;
Dts.Events.FireInformation(0, "SCR - Check file timestamp", "Processed file " + Dts.Variables["vFilename"].Value.ToString()
, null, 0, ref fireAgain);
}
else
{
// If the updated date is before the date specified, do not process.
Dts.Variables["vProcessFile"].Value = false;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment