Zip a complete folder in Blue Prism

rsingh40

Member
Hi All,

I have a folder with multiple files. I want to zip all the files in that particular folder.
Need your help in doing this in Blue Prism.

Thanks in advance
 

VJR

Well-Known Member
Hi rsingh40,

If you have .NET framework 4.5 it now has System.IO.Compression.ZipFile class.

Only 1 line of code is needed to zip or unzip a file as shown below.
https://msdn.microsoft.com/en-us/li...aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

But if you have lower versions then you might have to either use a 3rd party dll or write your own zip compression algorithm.

There are other compression classes made available by Microsoft like DeflateStream and GZipStream, which compress the files but they create extensions other than .zip.
https://msdn.microsoft.com/en-us/library/system.io.compression(v=vs.100).aspx
 

rsingh40

Member
Hi VJR

Thanks a lot.
Basically I don't have any coding experience so facing problem with what to include in Namespace import and External References even I get code.
 

VJR

Well-Known Member
Hi Lela,

Can you tell more what is the "same Problem" you are mentioning about as I re-read the above posts and don't see any specific problem mentioned.
 

Lela

New Member
Hi Lela,

Can you tell more what is the "same Problem" you are mentioning about as I re-read the above posts and don't see any specific problem mentioned.
I have a zipfile that i want to unzip in a particular Folder.
I Need help doing this in Blue Prism! i am using 7-Zip
 

VJR

Well-Known Member
Hi Lela,

If you are using 7 Zip are those files zipped with an extension of .7z or .zip?
If it is .zip then you would be easily able to unzip it using the above suggested method which @rsingh40 was able to work it out. If .7z then you might have to look for a code that would do the same.
 

Lela

New Member
Hi Lela,

If you are using 7 Zip are those files zipped with an extension of .7z or .zip?
If it is .zip then you would be easily able to unzip it using the above suggested method which @rsingh40 was able to work it out. If .7z then you might have to look for a code that would do the same.

Hi,

thanks for the quick answer!
it is a .zip Extension. How can i do it if my zipfile is encrypted?
 

VJR

Well-Known Member
Hi Lela,

This seems to be easily doable from the command line with the help of these links.

i. https://stackoverflow.com/questions...ract-a-password-protected-zip-file-on-windows
From the above link it looks like the below is the command to extract using the key
"C:/Program Files (86)/old7-zip/7z.exe" x -pKey "C:/YOURE_ZIP_PATH"
..but go through the other answers too.

ii. Also refer the Command e (for extract) section in the below link
https://www.dotnetperls.com/7-zip-examples

iii. For doing this through the power shell refer the 'Best answer' in the below link
https://community.spiceworks.com/to...-using-7-zip-with-password-protected-zip-file
Power shell is free tool included with Windows. You can search this forum on how to use Power shell.

Post back with which options you implemented and how did it go.
 
Top