I’m trying to execute a process that reads text from each file in a folder. When setting this up, I assign FolderName = the location of the folder and Files = “Directory.GetFiles(FolderName)”. Then I start a For Each with ForEach item in Files and I have ResultSplit = System.IO.File.ReadAllText(item.ToString).
The error I’m getting says: “Could not find file” and then lists a file position different from the one I have typed into the assign. The error appears to be throwing at the first assign block inside the body of the loop in which I try to read the text file.
Hi
Kindly remove the double quotes for this expression
As it should be like this Files = Directory.GetFiles(FolderName)
where Files is a variable of type array of string which will store all the filepath of files in that folder
—now pass this array variable to FOR EACH activity as input and change the type argument as string in the property panel
—inside the loop use a ASSIGN activity like this
ResultSplit = System.IO.File.ReadAllText(item.ToString)
Where if it’s a text file instead of this assign activity inside the for each loop we can use READ TEXT FILE activity and pass the input as item.ToString which will either give us the string in that text file as output variable