Aug 5, 2010 at 6:44 AM
Edited Aug 11, 2010 at 5:54 AM
Works reliably, could do with some documentation though...so here's some advice...
All the Properties in 'UnZip SSIS Parameters' section can be set either by literals or using expressions:
Most important properties are:
- TypeOperation ( choose Compress to Zip or Decompress to UnZip)
- RegExFileFilter (Use a .NET regular expression string to limit the files you want to zip from the FolderSource ...seems to only be of use in Compress mode??)
- FileZip (Depending on the TypeOperation you have set this is either the output zip file, or the file you want to UnZip/Decompress)
Notes on Compress mode:
You cannot use a specific file name as the 'FolderSource' property (rather than a folder).. it just creates an empty zip file.
This means that if you want to use TaskUnZip to zip up whole folders into one .zip it is great…but if you want to zip each file into an individual .zip it will require a little work...one way around this would be to move files into individual folders.
N.B. If there are no files in the folder source (or that match the RegEx) then TaskUnZip still produces an empty zip file. You can get round this by adding a script task before that counts files and cancels package, or transfers
control elsewhere if there are no files to work on.
Notes on Decompress mode:
If you have a number of files in a folder you want to unzip, you still have to specify the file to unzip (FileZip property) ..i.e. you cannot leave this blank and just specify 'FolderSource' and expect it to unzip
all of the .zip files in the folder.
Therefore you will have to put taskunzip into a "For Each FILE IN FOLDER" loop (setting the FileSpec to *.zip) and map a variable to the collection value...then you can use that variable in the expression for FileZip property.