Get All Files in a Directory or Folder using UiPath Studio

In this post, we will get all the files present in a folder and print their path on the output panel. First, we will store the files in an array of string and then we iterate through the array.


  1. UiPath Studio

Add a new assign activity. Create a new variable by pressing Cntrl+K. Name the variable listOfFiles. Give the value of variable as below –

Directory.GetFiles("<Your Folder Path>")

You will notice an error because we need to change the variable type to System.String[]. Open the variables panel and change the type.

Add a For Each activity and iterate through the list of files and print their path on the console using the Writeline activity. You will have to change the item/file to string in order to print.

Your complete flow looks like this.

International Open Academy

Run the process and check the output.

Thank you All!!! Hope you find this useful.

If you liked our content and it was helpful, you can buy us a coffee or a pizza. Thank you so much.

International Open Academy

Up ↑

%d bloggers like this: