SSIS 2005 - How to get the timestamp properties for a file
How do you get a timestam开发者_高级运维p from a file with SQL Server Intergration Services 2005?
You'll have to use a script task, something along these lines should do the trick:
Dim filePath As String = "C:\YourFolder\YourFile.ext"
If File.Exists(filePath) = False Then
Dts.TaskResult = Dts.Results.Failure
Return
End If
Dim currentDate As Date = DateTime.Now
Dim fileCreateDate As Date = File.GetCreationTime(path)
If currentDate.ToShortDateString <> fileCreateDate.ToShortDateString Then
'Do something
End If
You can use the open-source File Properties Task to get and/or set any one of the three timestamps on a file.
精彩评论