Move Files with dynamic path

I am downloading pdf’s from a portal and the pdfs are available in batch wise like (ex. batch1 have 25 pdf, batch2 have 20 pdf)
So when i download batch1 pdf’s i want to move those pdf’s into the folder name of batch number
after that will download batch2 pdf’s then need to move into batch2 folder
(batch number will change everytime and pdf name also change every time)
please advice

Above is the destination path for move pdf

hi @manish_patel,

Welcome to the UIPath community.

  1. How do we identify the batch Name ? The same Login will be used to create the Folder . Assuming Batch 1 is decided by a Selector on Screen.
  • a. So we take a StrVariable based on the selector and Assignvalue as “Batch1”.
  • b. We take a Create Directory and Create the Fodler Batch1 at desired location. “D:\Data\Batch1” and Store this path in a variable say BatchPath .
  1. while Downloading - In the Save as - We Pass the Path BatchPath created above and folowed by the FileName.

“D:\Data\Batch1\File1.pdf”

  1. If File Names are Random you can save the File by the Name you Decide appended by Date Time Second Stamp
    eg :sampleName_06_06_2020_15_14_23.pdf


Mukesh

1 Like

Hy @manish_patel,

You can also use a ‘For each’ activity to loop through all the files inside a folder and so

To a variable type array of strings, assign = directory.getfiles([FolderPath])

1 Like