Zip/Unzip files
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-19 03:24 AM
Hi everyone!
I need to zip a group of files in a .zip, this zip has to be encrypted with a password. Also i want to unzip a .zip file into a directory. I want to create that object, and tried to many times, but didnt work.
I've looking for this in the forums but all the topics are like "you have to copy and paste this into a code stage but need a reference to a dll", didnt found a step by step on how to do that, and my english is not that good 😞
if you could help me in any way ill be grateful
Greetings, Daniel.
Daniel Sanhueza
RPA Professional Developer
Deloitte
RPA Professional Developer
Deloitte
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-19 01:12 PM
Hello, dsanhuezai
I was in the same position you are right now last year.
To create a zip file with password, I thing you would need program that are specialized in making zip file (7zip, WinZip, etc.)
In my case I used WinZip to create a zip file with password.
Use ""Utility Environment - Start Process"" and set the following parameter
Application >>> ""C:\Program Files (x86)\WinZip\WZZIP.EXE""
※Please make sure where your zip file making program's exe is at※
Argument >>> -a -p -r -s"""" """" ""\*.*""
※Replace with a password that you want※
※Replace with a full path of the zip file you want (ex.D:\Desktop\TEST.zip)※
※Replace with a path of folder where all of the files you want are saved (ex. D:\Source)※
For unzipping the file you could follow the similar approach (use Start Process action)
Please try following the link below and try to unzip the file
http://www.memecode.com/docs/winzip.html
Regards,
Met Vonghiran
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-04-19 01:02 AM
Hello and thanks for the quick answer!
I did what you post here but with no results
For this example, i just created a empty folder to zip it. so, in the arguments i wrote : ""-a -p -r -s '123' ""&[ZipFile]&"" ""&[SourceFolder]&"".*"" i replace the """" for '' in the arguments, because with """" inside, didnt work.
I tried to put the complete argument with no """" and no '', but again nothing happened.
Think im missing something, but dont know what.
Should i do something else?
Daniel Sanhueza
RPA Professional Developer
Deloitte
RPA Professional Developer
Deloitte
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-04-19 02:10 AM
If you have .NET/Powershell 5 on that box (this is installable if you don't have it), there's a zip command built in to that you can use. An example compression powershell script is below.
Param( $source, $destination, $level, $confirm, $force, $whatif ) $Params = @{ Path = $source DestinationPath = $destination }; # = " -Path " + $source if($level -ne $Null) { #$paramlist += " -CompressionLevel " + $level $Params.Add("CompressionLevel",$level); } if($confirm -eq "True") { #$paramlist += " -Confirm" $Params.Add("Confirm",''); } if($force -eq "True") { #$paramlist += " -Force" $Params.Add("Force",$force); } if($whatif -eq "True") { #$paramlist += " -WhatIf" $Params.Add("WhatIf",''); } #$paramlist += " -DestinationPath " + $destination Compress-Archive @Params
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-04-19 07:24 AM
Hello, dsanhuezai
First thing first, I'm glad that you also happened to be using WinZip as well.
I couldn't replicate the error message that you had. but here is how you can troubleshoot it.
Create a text file and within that text file please insert following command:
""C:\Program Files (x86)\WinZip\WZZIP.EXE"" -a -p -r -s""password"" ""ZipFilePath"" ""Source_Folder\*.*""
※Change the password, ZipFilePath, Source_Folder accordingly. ※
""Save as"" the text file and change the extension to "".bat"" file
Run the bat file (without using BP, just double click on the bat file). This way you can try and see if there's any error message comes up or not.
Please Note that you cannot create a zip file from an empty folder, and your password must be more than 8 characters.
Also, it might be a good idea to try amibarrett's solution (The post above) as well.
Regards,
Met Vonghiran
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-05-19 02:40 PM
Hi.Â
Great Post!Â
I'm struggling replicating this code trying to UNZIP files with password using WZUNZIP.exe.Â
Any idea how to create the code when trying to unzip a zip file?Â
Also, i have tried to create a code;Â
@echo off
set yourZipPassword=[password]
set yourFolderPath=[location]
for /R "%location%" %%I in ("*.zip") do (
 "C:\Program Files\WinZip\WZUNZIP.exe" x -sPassword -y -o"%%~dpI" "%%~fI"Â
)
Â
But the command promt returns; ERROR: missing suboption in option y
Â
Thanks!
