How to store file names in a UiPath list variable

Hello,

I would like to loop through all the files in a directory, get their names and stock them in a list variable.

What I tried:

  1. Create string variable containing directory path

  2. Place a for each activity where we loop through Directory.GetFiles(directory_path)

  3. How can I store the string values in a list ?

Thank you !

Directory.GetFiles(directory_path).toList
Or a you interested on the filename only without folder info

2 Likes

hi thnx for the fast reply. Do I use an assign activity to this ?

assign value should be of data type list ?

assign activity
LHS: myFileNames | List (Of String)
RHS: Directory.GetFiles(directory_path).toList

which list in array ?

grafik

1 Like

solution! thanks bro