May 10, 2011

SSIS – Process files in Sequence - Sudeep's Domain


I got a very interesting scenario in Ask Sudeep section of BeyondRelational.com. Let me share the scenario first and then will explain how to go about it.
Scenario:
There is a folder which contains a number of files. The file name follows the following naming convention . Alphanumeric could be any valid alphanumeric characters and the Number part would have just numeric values and both would be separated by a period [.]. Examples of file name file1Name.1, file1Name.2, file2Name.5 etc. Now the requirement says that for a given group of Alphanumeric part which are same we need to start processing the files from the file having the minimum numeric part and keep on processing the file till we get the numeric part incrementing by one for the files. Then move to the next set of files with another Alphanumeric part. Better to see an example, will give a clear picture.
List of files in the folder:



a.1
a.2
a.4
a.5
b.10
b.11
b.15
b.16



There can be 2 sets of files based on the alphanumeric part once with a and the other with b. From the above list we need to process just the following files:
a.1
a.2
b.10
b.11


As there is a break in the sequence for the file group “a” as a.3 is missing and similarly b.12 is missing so no files with larger numeric part will be processed.


Read on....

No comments:

Post a Comment

Thanks for your valuable comment!!