Skip to main content
Kofax

How to create a robot step to zip/unzip files

3023777

Summary: 

Robots don't have built in steps that would zip/unzip files. But this can be done using a third party utility that has command line parameters to zip/unzip.

The example below uses 7-zip but, in a similar way, any other utility can be used.

More Information: 

Install 7-zip on the machine where Design Studio is (to be used when building and testing the robot) and on all RoboServers where the robot would run.

To zip files  
  1. In the robot add an Execute Command line step
  2. in the step configuration enter the following command in the "Command line" field:

    <7-zip Installation folder>\7z a -tzip <target archive location> <source file/folder

    E.g. "c:\Program Files\7-Zip\7z.exe" a -tzip C:\Temp\Output.zip C:\Temp\SourceFile.txt

 

To unzip files
  1. In the robot add a Write File step to write a bat file, e.g. C:\Robots\Unzip.bat
  2. File content should be

     cd <location of the archive file>
    "C:\Program Files\7-Zip\7z.exe" e <the archive file>


    E.g.
     cd C:\Temp\
    "C:\Program Files\7-Zip\7z.exe" e Output.zip

     
  3. In the robot add an Execute Command line step and configure it to launch the bat file created at step 1.

 

Applies to:  

Product Version
RPA Any

 

 

  • Was this article helpful?