Last active
July 11, 2021 04:30
-
-
Save tdmitch/db9531e7e2510b009e46fdc80765665c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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