Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS Exclude certain files in Foreach Loop Container

I have a SSIS package that loads csv files from a particular directory, using an expression and a wildcard for picking up all the files.

Currently, the FileSpec of the container looks for all files with the following format:

fileName_environment_*

and this is working fine. A second set of files are now bing loaded from the same directory, and to distinguish these, the file format is:

fileName_environment_business_*

So, the second SSIS package picks up only the new files since the structure of the files will look like:

filename_environment_abc 
filename_environment_def
filename_environment_xyz 
filename_environment_business_abc
filename_environment_business_def 
filename_environment_business_xyz

but the first package will process all files.

So, the question is, can I set the FileSpec of the first SSIS package to ignore the files which are in the format:

fileName_environment_business_*

like image 720
Christian Phillips Avatar asked Sep 30 '13 11:09

Christian Phillips


1 Answers

In the foreach loop container put a dummy Script task before the first block you've got already. Connect those two with a line and set Constraint Options to expression, in which you should define a FINDSTRING function:

FINDSTRING(@var, "business", 1) == 0

Where @var is the loop iterable.

Only files without "business" inside will proceed to the next step. Hope this is what you wanted.

like image 143
makciook Avatar answered Sep 20 '22 14:09

makciook