June 9, 2008 at 2:47 am
Hi All,
I am new to SSIS. Please help out to solve my problem.
In my SSIS package I am using a File System task to delete a set of files from a folder. The task is contained in a For Each Loop.
All files use the same convention for naming: filename_CompanyNumber.csv
I would like to delete all files except the ones that end with a CompanyNumber value 120. How to achieve this?
Your assistance is highly appreciated.
Thx....
June 9, 2008 at 5:26 am
Just to make my problem simpler ... from the ForEach Loop Editor I would like to list the files that I am going to delete.
Example: *_101.* and *_106.*
But How should I type them in a list?
I know that: *_101.*;*_106.*
don't work?
June 9, 2008 at 6:21 am
What you have is a list of files you do not want to delete.
So, I would simplify this a bit and loop through all fiels with a ForEach loop.
Each time through the loop, you will get a file name into your variable (I assume you have this working).
Now, I have not seen a way to skip a task based on expression except if you have another task and precendence constraint. Since you have only one file system task in your loop container, this is an issue - but it is not. Add a sequence container to your ForEach loop and drag the green arrow from the Sequence container to your file system task.
Then, double-click the connector and change the precedence constraint type to "Expression" and then make an expression that checks the file name and returns true if it is a file you want to delete.
June 9, 2008 at 2:11 pm
Demitri,
If you want to delete all of the files with company number between 100 and 109, then you could enter *_10*.* as your selection criteria. If there are files for companies in that range that you don't want to delete, then the simplest way to do it is to use two file system tasks, one for each company number.
Hope this helps,
Bryan
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply