UIPATH mutliple files in destination folder and create folder names according to files

I got multiple files (PDF) in a folder and need to create for each file a new folder according to specific and unique name / number each file have.

will like help and solution


1 Like

Hey @nir.kail

You can utilise For each file activity,

  1. Then create folder as required inside loop for each file.

  2. Move the file to that specific folder using Move activity.

Hope this helps.


1 Like


Welcome to our UiPath community.

Please follow below steps.

  1. First use below expression to read all pdf files from the source folder as below.

           arrPdfFiles [] = Directory.GetFiles("FolderPath","*.pdf")
  2. And then use For Each loop activity to iterate one by one file from above output array.

For Each item in arrPdfFiles
    Use Create Folder activity and pass name as below.  
      And then use Move File activity and pass below parameters to it.
              From Path: item
              To Path: "FolderPath"+"\"+Path.GetFileNameWithoutExtension(item)
1 Like

Welcome to the UiPath community Nir, these are both great replies and possible solutions for your project. I also support using a For Each Loop within the file directory. You can also add a counter variable that can be used as a unique identifier on the folders that are subsequently created. If you wanted the folder name to include the counter and something else, you could use an assign node to perform a simple concatenation and customize the folder name how you see fit.


Thanks for the answer

Which activity I need to use for the:


Also I can I add –

For Each loop activity

I can’t see it in the activity list




Search for For Each activity


Thanks for your help

Also if you know Which activity I need to use for the:




@nir.kail Please find attached workflow below

Example.zip (59.7 KB)

This workflow creates folders with the file name and moves the file to that folder

Note : if you don't want the file to be moved to that folder disable Move File activity in the code