Move the .pdf file from the folder inside the .zip file to a different folder

Hello there,
I have the folder with a lot of .zip files. There are many folders in the zipped file. I want to move the .pdf file in the folder named attachments to a different folder. Can you help me?

Hi @ridvanucok

Welcome to forum

The first thing u need to do is u need to unzip the folder and then take the pdf files and move to another folder

Regards

Nived N

Happy Automation

Can you help me with what activities I should use?

Steps to be followed

First unzip the folder using zip activvity. U can use balareva activities for this

Second after extracting the folder, u can use the move files activity to move your files

Can u send a screenshot of how your file structure look like?

I have many compressed files. How do I do it with Balareva? I have attached the .zip File image.

@ridvanucok - So first you have to unzip/extract all the folders in the zip file first…

Then read all the folder using directory.getfiles…and then in the folder…move the file one by one to the new zip file.

please confirm if my understanding is correct? if yes, I can build a sample workflow for you.

so each one is a compressed folder? @ridvanucok

Yes. Each zipped file.

There are many zip files in a folder. Each zip file has a folder called attachments. In the folder named attachments there is pdf with filename variable. I want to move these pdf files in each zip file to a different folder.

@ridvanucok - Got it…Almost…will share the workflow in a min

Update: Unzip_Pdf_Rezip.zip (371.7 KB) … Run this workflow as is you will see new ZippedPDFFiles.zip created in the project folder…

  1. First extract all the zip files to a folder
    2.Extract only .pdf files and move to new PDFFiles folder
  2. Zip the PDFFiles folder(If you dont need this step just simply delete/ignore)

Hope this helps…

1 Like

What activity did you use in this area?SAVE_20210220_221014

@ridvanucok - That is Extract/Unzip Files activity…

image

Other one is…

image

1 Like

What package is this installed? These activities are not loaded in my program.

@ridvanucok …what version you are using ? Also go to manage packages and check any of your packages needs to be updated(shows with blue arrow).

1 Like

Thank you so much for your help. :slight_smile: df file names in the attachments folder are the same and overwrite. Do you have a suggestion for this?

@ridvanucok …oh…so in your case each attachments folders has pdf files with same name? Say

1.Zip > attachment > 1.pdf

2.zip > attachment > 1.pdf

3.zip > attachments > 1.pdf

Like this?

1 Like

Yes true.

@ridvanucok …hmm…in that case you have to put the each attachment folder pdfs in individual folder with zip file name. Say

1 > 1.pdf

2 > 1.pdf

3 > 1.pdf

Like this?

Can we change the names of the .pdf files in the folder and move them to a new folder after doing as you mentioned?

@ridvanucok - how you are thinking of renaming the files? May be we need to add the zip folder name to the files…like

zipfile1 > attachment > 1.pdf to zipfile1_1.pdf

this will make pdf file name unique…

1 Like