Unzip several files in several folders

Hi, I have a folder with several subfolders, each subfolder has zip files, I am trying to unzip each file that is in each subfolder but it has not been possible.

I mean, I need it to enter each folder and if there are zip files then unzip them and so on with all the folders.

Hi @manuel.rojas,

Have you had a chance to try this?

Directory.GetFiles("your file path","*.zip", SearchOption.AllDirectories)

Regards,
MY

1 Like

Main.xaml (9.9 KB)

I currently have this

I did this to test that with many zip files in a single folder and yes, they all unzip, however I have zip files in many folders and not just one.

1- First, fix the equation as follows.

Directory.GetFiles("C:\Users\Juanr\Documents\UiPath\Factura_Electronica\Archivos correo\Prueba","*.zip",SearchOption.AllDirectories)

2- Update your variable type to String.String.

and then? how do I use the for each?

When you update these fields, the for loop will return it as an array list.

Each item in the loop becomes a zip file and this folder will bring you all the zip files in that directory in order.

The “typeArgument” of the for each is “System.IO.FileInfo” this way I get the “extract” activity to allow me to use “item.FullName” and “item.DirectoryName” as shown in the image, then if I change the “TypeArgument” it will show me an error.

What should you do?

Main.xaml (6.2 KB)

You can use your uipath activity. You don’t need to go to an external activity. It comes when you type extract. I am sharing how to use it below.

1- Directory.GetFiles("C:\Users\Juanr\Documents\UiPath\Factura_Electronica\Archivos correo\Prueba"," *.zip",SearchOption.AllDirectories)`

2-String.String

3-"extract folder path"

Path.GetFileName(item.ToString)

image

The folders (purple color) have zip files which are unzipped in folders (green color) but as you can notice they are unzipped outside their place of origin, I need them to be stored inside the same folders (purple color).

Hi @manuel.rojas,

Sorry for the late return.If you update the destination field like this, it will extract every zip folder to the file containing the zip.

item.Replace(Path.GetFileName(item.ToString),"")

Regards,
MY