Read files in each folder and output result in that folder

Hello All ,

I have created a robot to read pdf files take necessary information from them and output them in txt file in the same folder. But the issue is that i have assigned inputfolder and outputfolder and every time i need to get this information i need to change the input folder and output folder. Since i have for example 100 folders where i need to get this information i need to make it to go every folder automatically and save there the output and than go to the next folder to the same. Thanks in advance.

Best regards,

Hi, @Shwapx

you can try the following steps.

  1. Build a collection that contains directory of all the folders wher eyour PDF files are present

( string[] allfiles = Directory.GetFiles("path/to/dir", "*.*", SearchOption.AllDirectories); )

  1. Loop through each directory item (each folder int he string array)
  2. Use PDF activities (read, create etc) and save it using the same item in the loop for your text file

Hope this helps

Thanks.I will test it out soon and will report.

Okay I’ve done it like this and it’s reading all pdf in all folders , but at write the text file what i need to put as output since if i just put the variable from allfiles got error.

image

If i don’t include this will save the files in the project folder and will not save them in each folder. Since i want the txt file to be saved on his folder.Example : Folder 1 read pdf wrtie txt file in that folder / Folder 2 read pdf write txt file in that folder.

This xaml might help your purposes, I have tweaked the code to match your requirement.Main.xaml (8.7 KB)

Thank you for the help :slight_smile:

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