SSIS - How to Compress And Archive File In SSIS [ Execute Process Task ]

Scenario: 

We receive different source files on daily basis. After loading them to our destination tables we want to compress them and Archive them to Archive folder in case we need to use them later. 

Solution :

We will be using 7 Zip to do this. 7 Zip is open source software and can be downloaded free.  Here is the link for more details

http://www.7-zip.org/

Step 1: 
Down  7 Zip from above link or from other resource on internet. We will be using the executable that is 7z.exe in SSIS to compress and archive our source file to Archive directory.

Step 2: 
I have created SourceFolder and ArchiveFolder on my desktop and my source folder has one excel file Book1.xlsx


Step 3:
Create three variables in your package and provide values as shown below. you can set the values of these variables by using configuration or by using For-each loop while loading the file etc.

Step 4: 
Bring Execute Process task to Control Flow pane and configure as shown below

Expressions
Executable : @[User::VarZipExecutablePath]
Arguments: "a -t7z \""+@[User::VarArchivePath] + "\"  \"" + @[User::VarSourcePath] +"\""



Final Output: 
Let's run our package.

As we can see the the package ran successfully and compressed file is archived in Archive folder. 

For more details of switches available with 7z.exe, please visit 
and




The video tutorial is about "How to archive files by adding datetime to them and move to other folder. It does not show how to compress the files."