Discussion

1
Replies
2121
Views
sasnt Member since 2016 9 posts
PEGA
Posted: January 6, 2017
Last activity: January 23, 2018

Zipping and Unzipping Files in Pega Robotics

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.

  1. Add a new script component to your global container.
  2. 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;

  • archiveFileNameIn - The full path to the zip file
  • password - The password for the archive
  • outFolder - The directory to unzip the file to

The parameters for UnzipFile are;

  • zipFileName - The full path to the zip file
  • targetDir - The directory to unzip the file to
Robotic Process Automation Developer Knowledge Share
Share this page LinkedIn