且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于检查文件是否存在于文件夹中的 SSIS 脚本任务

更新时间:2023-11-27 09:11:22

变量:

文件夹 - 字符串 - C::Temp

folder - string - C::Temp

文件 - 字符串 - 1.txt

file - string - 1.txt

fileExists - 布尔值 - 假

fileExists - boolean - False

public void Main()
{
    string folder = Dts.Variables["User::folder"].Value.ToString();     //@"C:	emp";
    string file = Dts.Variables["User::file"].Value.ToString();         //"a.txt";
    string fullPath = string.Format(@"{0}{1}", folder, file);

    Dts.Variables["User::fileExists"].Value = File.Exists(fullPath);

    Dts.TaskResult = (int)ScriptResults.Success;
}