Execute Process Task – Compress File Using 7-Zip

How to Zip multiple files using Execute Process Task and move into desired location
1) Create Foreach loop container And Execute Process Task


2)Make Collection for Each loop container

3) Variable Mappings






4) Make executable path in Execute Process Task for 7-Zip






















5)Make Arguments with Expression




























6)Make Variables














Deszippath : zipped files where need to store.
Sourcepath: Original path of files

filename: we are taking the file names with extension
fileShortName: we get short filename using this expression  Replace(@[User::filename],".txt","")

Command for zip :       a "C:\Test\test.zip" "C:\Test\01-01-2012\test.txt"

zip command In Expression :   "a "+"\"" + @[User::Deszippath]  + @[User::fileShortName]+ ".zip"+"\""+" "+"\"" + @[User::Sourcepath]  +@[User::filename]+"\""

Unzip File
-----------
variable  @[User::FullFileName] contains zipped file. example  "\\job\test.txt.gn"
Arguments: "e "+ @[User::FullFileName]  +" -aoa"
Executable:  C:\Program Files (x86)\7zip\7zip.exe
WorkingDirectory: C:\Test\      (we load unzipped file in working Directory).

Command for unzip: e \job\test.txt.gn -aoa








No comments:

Post a Comment