How do I run a certain activity (Google vision OCR) on every file within each subfolder, while all the subfolders are within the same folder?
Suppose your all subfolders are inside C:\TestFolder
Directory.GetFiles("C:\TestFolder", "*", SearchOption.AllDirectories)
The above code will give the path of all files within the TestFolder and the Folders inside it.
So, you will need only one for loop
That is a very useful method. But I need to process each subfolder separately. I am running all the JPGs in each subfolder through an OCR and sending the output to a separate Word doc. So there will be one text file created from scanning all the images within each subfolder. And ideas?
In your workflow, in the outer for loop use Directory.GetDirectories(path) method to get all subfolders path inside the main folder.
Then, the in the inner loop use directory.getfiles(folder) to get all the files inside the subfolder for the current subfolder in iteration
To write the text file use the path → folder.ToString+“\filename.docx”
Outer For Loop → ForEach
Innder For Loop-> ForEach
Path in WAS →
That’s exactly what I needed! Thanks very much
Mark the post as solution to close the topic.