2010-03-19 57 views
2

有没有任何方法来检查文件是否存在没有脚本任务?可能是foreach循环容器或其他东西..SSIS文件存在检查没有脚本任务

+0

为什么你不想使用脚本任务? – grapefruitmoon 2010-03-21 18:03:57

+0

64位问题。我得到错误的PreCompiledBinarycode和修复程序安装不是一个选项,因为客户端resufsed安装它。所以我必须考虑一些替代方案。 – pramodtech 2010-03-22 04:44:54

回答

0

如果你可以使用自定义组件,试试这个:File Properties Task。它是开源的,所以你可以看到它到底在做什么。您需要将其安装在开发人员和产品包装盒上 - 使用安装程序或手动安装到GAC中。但这样做,你有一个比文件系统任务更容易使用的拖放任务...但后来,我有点偏...

+0

我很无奈我无法在客户端的服务器上安装任何开源代码。 – pramodtech 2010-03-23 06:54:04

+0

你想要封闭来源吗?尝试务实的作品。他们有一个工具箱,它有一个类似的任务。 – 2010-04-14 21:58:30

1

我想出了如何检查文件而不使用脚本任务。

1) Add a ForEach Loop Container to your Control Flow. 
2) On ForEach Collection pane, set Enumerator to "Foreach File Enumerator" 
3) Set Folder to your Source Folder. 
4) Set Files to your File Spec (*.*). 
5) On Variable Mappings, create new variable "User::FileExistsFileName" 
6) You then just need to configure two output Lines for the ForEach Loop: 

7) For Success Line: Double-click the Connector Line, set: 

Evaluation operation: Expression 
Value: Success 
Expression: @[User::FileExistsFileName] != "" 

8) For Failure Line, set: 

Evaluation operation: Expression or Constraint 
Value: Failure 
Expression: @[User::FileExistsFileName] == "" 

我喜欢设置评估操作为失败“表达式或约束”只是为了把红线。