How to use Foreach Loop with Zip Files

  • Hello everyone,

    I have a question , this is my first question here, I have SSIS package loop through folder and import the CSV files to DATABASE , my question is , Now , I recieved one big zipped File contain about 4000 CSV file , daily , I recieved about 20 zipped file , is there anyway that I can make the ssis loop through the zipped file and Import the CSV files ?

    I wonder if someone have a simillar package

    Best Regards

    Moaen

  • I use pkzip running from a Execute Process Task.

    Initially I tried to use this free zip library from http://www.icsharpcode.net/OpenSource/SharpZipLib/ ,

    but I could not get it to function from a Script Task.

    Then I was made aware that we owned a licensed pkzip for the command line and I switched to that rather than install SharpZipLib (a new dll) on our production servers. I stopped pursuing the SharpZipLib at that point.

    Norman

    DTS Package Search

    http://www.dtspackagesearch.com/

  • Thanks Norman,

    That's very helpful, but I still dont get it right , how in my foreach loop after set the folder which contain the zipped file to catch the zipped file , and then copy everything (*.*) from that zipped file

    Many thanks again

    Moaen

  • Moaen,

    The unzip should occur before the foreach loop

    The package should look like this:

    Unzip(Execute Process Task)->Process Each csv file(ForEach Loop)

    The unzip will unzip all the csv files in one step, then the csv files can be processed.

    Norman

    DTS Package Search

    http://www.dtspackagesearch.com/

  • maan_mustafa (12/6/2007)


    Hello everyone,

    I have a question , this is my first question here, I have SSIS package loop through folder and import the CSV files to DATABASE , my question is , Now , I recieved one big zipped File contain about 4000 CSV file , daily , I recieved about 20 zipped file , is there anyway that I can make the ssis loop through the zipped file and Import the CSV files ?

    I wonder if someone have a simillar package

    Best Regards

    Moaen

    Here is a Foreach Loop example with a Scrip Task inside that unzips a zipfile and then processes the extracted source files: http://microsoft-ssis.blogspot.com/2011/01/unzip-files-with-ssis.html

  • If you can use third-party solutions, check the commercial CozyRoc Zip Task. It supports Zip, GZip, BZip2, Unix (rfc1950) and Tar archives and it is completely integrated inside SSIS.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

Viewing 6 posts - 1 through 5 (of 5 total)

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