Feeds:
Posts
Comments

Posts Tagged ‘ssis 7 zip’

For this I will use7-Zip software, if you don’t have ,download
this it’s free!

Assuming files that has to zipped together are in
C:\SourceFolder and you have to output processed zip file in
C:\DestinationFolder\

1. Create two variables FileName and DestinationFolder
of string type to hold
File Name and destination folder values respectively.

Assign C:\DestinationFolder\ to variable DestinationFolder

2. Drag one “Foreach Loop Container” and edit this point to
directory C:\SourceFolder and provide file type if you have to filter on
certain file types, in my case I was supposed to zip only PDF files.

Go to Variable Mappings tab and use variable FileName to hold
all file names returned by  “Foreach Loop Container”

3. Drag an Execute Process Task inside “Foreach Loop Container”

4. Open Execute process, go to Process tab and point Executable to
C:\Program Files\7-Zip\7z.exe
or wherever you have installed

5. Go to Expressions tab and then expand this, then click on browse
button this will open Expressions designer 

Choose Arguments under Property window and then again click on browse button this will open the second editor, the
Expression

Builder.

Then substitute values
in Expression window like below

"a"+" "+ @[User::DestinationFolder]   +
"NameofZipFile"+ ".zip " +" "
+"\""+ @[User::FileName]+"\""

Don’t forget to click on Evaluate Expression to check for any
errors

Just to note in my case zip file will be created in C:\DestinationFolder\

6. Execute your Package

 

 

 

Advertisements

Read Full Post »

%d bloggers like this: