Tuesday, December 13, 2011

SSIS: How to Compress/Zip your file using 7-Zip?

This post shows how you can zip your file using SSIS .

As per the need sometime you might need to zip your files in order to save some space or you might want to create a zip file and set a password on it before sending to some one.

File compression is a very interesting topic. There are many tools available to compress/zip your file such as Winzip, 7-Zip, ezyZip, WindowsRar and many more. We can use any one to compress/zip our file. I have used 7-Zip to compress/zip my file for this post.

I have following file in my local drive.

The file name is RupeeStory.txt and file size is 474 KB. I want to Compress/zip this file. I know the file size is not large but this is purely for demonstration purpose.

In SSIS, I have created a SSIS package and on Control Flow tab I have added an Execute Process Task task

I have setup the Process tab of Execute Process Task Editor as following. My file name is RupeeStory.txt and my zip file name is ZipMyFile.7z

After setting this I run my SSIS package and it runs successfully and created a zip file in my local drive.

Simple!!

Now I want to create a zip file and set the password on it. I edited the Arguments as following

a "C:\ZipMyFile.7z" "C:\RupeeStory.txt" -pabc@2011

Where abc@2011 is the password. So anyone extracting my zip file need to know the password

You can use the other settings as well like adding your file to an archive, deleting a file from archive, extract files from archive etc. The only thing is you should be familiar with the command-prompt switches or Start-up switches of your favorite zipping tool. In case you use 7-Zip here is an screen shot of all the start-up switches you can use.

I hope you like this article.

Related Article:

Popular Posts

Real Time Web Analytics