Loading last 7 days files with specific names in SSIS

  • Hello Everybody,

    I have a folder which gets a daily dump of 7 or 8 .xls files. Among all those files, I just need to load 2 files with a specific name.. ABC_datestamp.xls and XYZ_datestamp.xls.

    The problem is I am not able to isolate these 2 file names because there are so many other files in the same folder. The second challenge is that my manager wants me to load all files from last week at once, which means I have to specifically load files from last 7 days only.

    Right now I am copying those specific 7 files in to a folder and then loading it using a for each loop container.

    Is there anyway, I can use a script task to generate the file names like ABC_02-Dec-2011.xls, ABC_01-Dec-2011.xls, ABC_30-Nov-2011.xls .......last 7 days files and pass it as a variable to a DATA FLOW TASK?

    Any better suggestions ?

    I know a lot of people have asked similar questions but I am new to SSIS and not able to find good answers.

    Thanks a lot..

  • you want to load the last 7 files which correspond to the two file names you mentioned?

    take a look at this thread. it gives you the general idea that you're looking for:

    http://www.rafael-salas.com/2007/02/ssis-loop-through-files-in-date-range.html

    basically, you'll have a FOREACH loop looping through all your files. Then you put a dummy data flow task or script task, which doesn't do anything. The expression constraint leaving that task will let you filter to only choose the files that you want to look at.

    Then you'll pass those to a data flow task or a script task to actually do the processing, depending on what it is you're trying to do.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply