How to get files in a folder in UiPath?

How to get files in a folder in UiPath? I want to get the files and rename it.

1 Like

You can use the get files activity to get a array of strings with all the paths of the files. For the renaming you can use the copy file activity in a for each loop. Set the file path from the array to the input file and for the destination path change the same file path as you wish. Then delete the old file.

Maybe it’s easier possible with only using the move file activity.


In which package do we get Get file activity?

Hi @sivapriya.s

You can use the below code to get the list of files in a given folder…


This will give you a string array of files.

Next use a for each activity to loop through each file.

Inside the loop, use the move file activity…
For the source give the item variable of the loop, for the destination, give the file path of the item variable along with the new file name and extension

1 Like

@sivapriya.s sorry i got that wrong. The solution from @Lahiru.Fernando is correct.

Solution should look like that:

1 Like

@Lahiru.Fernando and @schwarzp

Thank you so much :slight_smile: