Hi,
How can I password protect a zip file created from Invoke method (System.IO.Compression.ZipFile)?
I tried to use UiPath.Cryptography.Activities.EncryptFile but the zip file is unable to be unzip in windows.
Thanks.
Hi,
How can I password protect a zip file created from Invoke method (System.IO.Compression.ZipFile)?
I tried to use UiPath.Cryptography.Activities.EncryptFile but the zip file is unable to be unzip in windows.
Thanks.
Hi @emily
For instance, If you want to extract all *.txt files from archive c:\archive.zip to c:\output folder,
use Start Process activity and set Filename to “C:\Program Files\7-Zip\7z.exe”,
set Arguments to “e c:\archive.zip -oc:\output *.txt -r”.
Hi wusiyangjia, thanks for the reply! I’m not trying to extract zip file but rather i want to set password for a zip file. Do you know how should I do this? Thanks.
Hi @emily
Maybe you can archive a zip file with password after extracting, as below.
C:\Program Files\7-Zip\7z.exe e c:\archive.zip -oc:\output *.txt -r
C:\Program Files\7-Zip\7z.exe a c:\new.zip -p123 c:\output*.txt -r
Hi @wusiyangjia, do you mean to use Invoke Power Shell? I tried the following but face the following error:
Invoke Power Shell: The term ‘C:\Program Files\7-Zip\7z.exe a D:\new.zip “D:\output”’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Hi @emily
For instance, there are two methods to extract from a zip file.
1.Use Start Process activity and set Filename to “C:\Program Files\7-Zip\7z.exe”,
set Arguments to “e c:\archive.zip -oc:\output *.txt -r”.
2.Use Invoke Power Shell activity with checking IsScript and change TypeArgument to String and set CommandText as follow.
“& ““C:\Program Files\7-Zip\7z.exe”” @(”“e”“,(”“c:\archive.zip”“),(”“-oc:\output”“),(”“*.txt”“),”“-r”“) | out-string;”
Hi @Palaniyappan, i did but the password function is not working for me. The zip file could be open without asking for password.
thanks @wusiyangjia, it works now! I have also added the password function, pls see below for those who may also face the same issue.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.