How to unzip a folder with multiple files using SSIS script task C# 2005 or 2008?

Ishan Trikha picture Ishan Trikha · Jan 3, 2014 · Viewed 18.9k times · Source

There is a requirement in my project that I need to unzip some zip folder. I googled and came to know without using external libraries I can not achieve this or with GzipStream class we can decompress .gz files.

Is there any way we can decompress without using any external libraries?

PS: I need to use only script task component for this and .Net framework is 3.0.

Thanks in advance.

Answer

StackTrace picture StackTrace · Jan 3, 2014

A) Declare a variable FileName as string datatype

B) Use ForEach loop to loop through the files in the folder and map file names to FileName variable

C) Use Execute Process task to zip/unzip to individual files

D) Execute the package

For steb by step short guide, see http://sqlserversolutions.blogspot.com/2008/10/zip-and-unzip-files-in-folder.html

You might also want to have a look at this http://gallery.technet.microsoft.com/Unzipping-with-SSIS-Script-6b055183