Copying only the zip files from one location and unzipping them in another

Hi,

I am looking to go to a file location, copy only the .zip files from that location and unzip them in another location. Thanks for the help.

use copy file activity and zip activities .

@fflattery

1.use for each to iterate zip files.
Directory.GetFiles(FolderPath,"*.zip")
2.inside for each use zip activity or invoke method …and In parameters pass the Folder path.

1 Like

Hi,

Thanks for the response.

i have checked if the files are zipped and then tried the invoke method. The check works okay but not sure what the invoke method is supposed to be doing.

The first parameter is the location of the files i checked and the second location is where i would like to copy the unzipped files. Am i doing this correctly?

correct…if invoke method is not working in your case …then use balareva zip activities.

1 Like

Hi,

Thanks for the reply. Yes the invoke method was not working for me. I was able to copy the zipped folder across using the balareva activities but it included .zip at the end of the folder name which i do not want.

On the attached screenshot: Path.GetFileName(item.ToString)

Then i have Var_TempFileName at the end of the extract folder path to try and give it the same name as the copied folder.

Any ideas on how to improve this?

@fflattery

In un zip activity pass this values.
ZipFile=Item.tostring
ExtarctFolder=YOurExtractFolderPath+Var_TempFileName
image

Hi @fflattery,

To zip and unzip you can use the below activity with the provision of password.

Regards
Balamurugan.S

Hi,

This is working fine now with just the .zip extension appearing in the folder name in the extract path.

Could this be avoided?

@fflattery

Get your file name without extensions…

FileName=Path.GetFileNameWithoutExtension(item.ToString)
Then pass this variable in extract folder name.

ExtarctFolder=YourExtractFolderPath+FileName

2 Likes

Hi @fflattery,
Sorry man took your xaml before you delete the thread. I have done some changes in your example xml.

  1. You are using the Old unzip activity . I have updated the latest one.
  2. In_SafeguardWorldPath and In_NetworkLocation these variable initialization has been commented. because I am passing the value throu main.xmal.
  3. I removed the if condition to verify that it is a zip or not.
  4. Sample zip file are exists in the Backup directory. Once you run, It it will delete all the zip from source.
  5. I have configured the local folders instead of network shared one.
  6. Run the automation from main.xmal.

Sample with changes.
fflattery.zip (92.2 KB)

Regards
Balamurugan.S

Hi thanks for this. the reason the zipped files were not being unzipped in the next location is because they were empty. My mistake. Thanks for this though

2 Likes

Hi,

Thanks for the help. When checking to see if any zip files exists it shows backup files despite the location appearing empth. How do i show that it is empty without including these files