If you ever have the need to zip and/or Unzip files within a Pega Robotics solution, here are a few scripts that can be used to do just that using a dll shipped with Pega Robotics Studio.
Add a new script component to your global container.
Right-click the component and add a reference to the ICSharpCode.SharpZipLib.dll located in the installation directory for Pega Robotics Studio (or the plugin).
3. Finally, create all four scripts using the attached text files.
4. The _CompressFolder script should be added first as it is used by one of the others.
When zipping a file, drap the ZipFile method from the script into your automation. It accepts three parameters;
zipFileName - This is what you want to name your resulting zip file.
password - This can be left blank, or you may supply a password.
folderToZip - The path to the folder containing the file(s) you want to zip. This will not zip an individual file as written, however you could possibly modify the script to do so if required.
When unzipping a file, drag the UnzipFile or UnzipFilePassword method out to your automation. These methods are identical except that the latter would be used if the zip file were password protected. The parameters for UnzipFilePassword are;