Directory.GetFiles(path) and read text file in the for loop - Not working

Getting the list of files (.txt) from a directory and iterating in the for loop to use “Read Text File”. But it’s errorring out.
for each item in Directory.GetFiles(path)
String file = new FileInfo(item.toString).fullName
Now use “Read Text File” activity - file to a String object.
But getting error in this “Read Text File” activity.

Researched from the below post that the filename was containing double slashes. So, tried replacing the string with “/”. Still no luck.

Really appreciate if anyone can help.
Rudy.

Hi, assign files(array of string)=
Directory.GetFiles(“yourfolderpath”,”*.txt”)

Now use a for each loop on the files variable with type argument as string. Your item variable shoyld contain the full file path and can be used ib read text file activity.

1 Like

Hi
The steps mentioned by @Sourav_Anand would help you buddy
Kindly try that and let know for any queries or clarification
Cheers @Rudrava_Som

Thank you so much Sourav. It worked. Really appreciate your time. :slight_smile:

1 Like

Yup it worked. :slight_smile:
Thank you so much Palaniyappan.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.