更新时间:2023-01-29 19:32:16
您可以向管道添加脚本组件,该组件从输入变量读取文件名并将文件修改日期写入输出变量:
You can add a script component to the pipeline which reads the filename from an input variable and writes the file modified date to an output variable:
/// <summary>
/// This method is called when this script task executes in the control flow.
/// Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
/// To open Help, press F1.
/// </summary>
public void Main()
{
System.IO.FileInfo theFile =
new System.IO.FileInfo(Dts.Variables["User::FilePath"].Value.ToString());
if (theFile.Exists)
{
Dts.Variables["User::LastFileDate"].Value = theFile.LastWriteTime;
}
Dts.TaskResult = (int)ScriptResults.Success;
}