There are times when I need to compress/zip data files for extended backup purposes. Typically I use either 7Zip or xStandard xZip to perform the task. However various companies security department prevent or disallow using anything that is not part of the base install.
It would be nice if there was a compress/zip plugin that was distributed with the base install.
In the meantime, here’s a WSC component ( Zipper.zip ) I wrote a while back that I use whenever I need to zip files.
To use it:
Unzip the WSC file in some known location (say, C:\Tests)
In a Workflow Script task, you can create a Zipper object by using the following syntax: var zip = GetObject("script:C:\\Tests\\Zipper.wsc");
Then you can do stuff like: zip.open("C:\\Tests\\MyZip.zip",Watch); zip.addFile(Watch.getJobFileName()); zip.extractFile("MyFile.pdf","C:\\Tests"); zip.addContents("<h1>Hello World!</h1>","MySnippet.html"); zip.close();
The WSC file contains a fair amount of comments, so you can read through them to get a better understanding of the available methods
It’s the same Watch object that is available in the scripting engine, and it’s aptly called Watch.
By the way, if all you want to do is extract files, you can simply use the Decompress task. The script in this thread was primarily provided as a way to compress files.