用于检查文件是否存在于文件夹中的 SSIS 脚本任务 [英] SSIS Script task to check if file exists in folder or not
本文介绍了用于检查文件是否存在于文件夹中的 SSIS 脚本任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查一个文件是否存在于 SSIS 的特定文件夹中.我怎样才能做到这一点?
I want to check to see if a file exists in a particular folder from SSIS. How can I accomplish this?
推荐答案
变量:
文件夹 - 字符串 - 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;
}
这篇关于用于检查文件是否存在于文件夹中的 SSIS 脚本任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文