我想检查文件是否存在于 SSIS 的特定文件夹中。我怎样才能做到这一点?
最佳答案
变量:
文件夹 - 字符串 - C::\Temp\
文件 - 字符串 - 1.txt
fileExists - bool 值 - 假
public void Main()
{
string folder = Dts.Variables["User::folder"].Value.ToString(); //@"C:\temp\";
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;
}
关于c# - SSIS脚本任务检查文件是否存在于文件夹中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17568554/