Skip to main content
0 reactions

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.

Prerequisites

  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 –

VB.NET
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.

Advertisement

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 (opens in a new tab)

Run the process and check the output.

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

Advertisement

International Open Academy (opens in a new tab)

0 comments