Please HELP....

  • Hello everyone,

    Here is my situation:

    My project was to consolidate many zipped folders that has many many files in each folder into a single database...However, the users just want one file from each folder loaded (the file has the same name in every folder)....Still there is like 100+ of them...And just b/c they needed it soon, I spent like 3 or 4 days just unzipping each folder, and loading each file MANUALLY!!! It took forever... SOOOO....

    Is there a way in SSIS to:

    Go from folder to folder and load each file into one database table? I have tried the For Each Loop, but it just looks for the file name from one folder...It wont go from one folder to the next to load the file...And I can just put the all of the one file I need b/c they have the same name...

    Im stuck! Any suggestions will be appreciated and I thank you in advance!

    If I was not clear on the situation, just ask and I will clear it up!

    Thanks,

    Adam

  • You could store all the differents paths in a table and then loop over this table with the foreach loop container.

    Map the string value in a row to a string variable and then write this variable to the connection string property of your file reader.

    The data in your table should like like this (with only one column)

    pathA\filename

    pathB\filename

    et cetera.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi Adam,

    Go from folder to folder and load each file into one database table? I have tried the For Each Loop, but it just looks for the file name from one folder...It wont go from one folder to the next to load the file...And I can just put the all of the one file I need b/c they have the same name...

    What you can do with the foreach file enumerator is go up one level in the tree and check the traverse sub folders checkbox. Then use a precedence constraint and expression as part of your control flow to test the filepath to see if it's one of files you want loaded.

    That should enable you to move from one folder to the next, but only load files with the correct name.

    HTH

    Kindest Regards,

    Frank Bazan

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

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