How to create a robot step to zip/unzip files
Article # 3036565 - Page views: 117
Issue
How do you zip/unzip files in a Robot?
Solution
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
- In the robot add a Write File step to write a bat file, e.g. C:\Robots\CreateZip.bat
- File content should be
<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
- In the robot add an Execute Command line step and configure it to launch the bat file created at step 1.
To unzip files
- In the robot add a Write File step to write a bat file, e.g. C:\Robots\Unzip.bat
- 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
- In the robot add an Execute Command line step and configure it to launch the bat file created at step 1.
Level of Complexity
Easy,
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
Kofax RPA | All |
References
Add any references to other internal or external articles