Output txt file in each folder

Hello ,

I have issue where i’m not able to output the result in each folder.
Basically i’m reading pdf and extracting information from pdf and want to output it in txt file in the same folder.

I did this at first with inputpath and outputpath , but when i have over 100 folders get kinda slow to change every time inputpath and outputpath want to make it to read all folders and output in the same folders.

I make it to read all folders , pdfs and extract the information , but i’m not able to make it output the result in their folder.


Product 1 = inside there are pdfs which robot will read extract information and want to output that information in the same folder with the name of the pdf just in txt.[Main.xaml|attachment]
Than robot go to next folder Product 2
Do the same
Than next.
Until all folders end.

Here is the robot thanks in advance : Main.xaml (8.2 KB)

Thanks in advance.

Hi @Shwapx

So if I am understanding correctly, you want to read the data from the PDF and output this extracted data into a .txt file that is saved in the same folder as the PDF, and you want to do this for all PDF files within the project folder?

If this is correct, then you should change the value in the FileName property of your Write Text File activity to be:


You also do not need to loop through twice, so you can remove the first For Each and leave only the pdf For Each (ensure the TypeArgument is set to String).

Also I am not sure how the first “Assign” was working for you to get the list (or you had changed it for privacy), but I found that using Get Environment Variable with “Current Directory” as the variable set will give you the correct file path for the project folder.

Hope that helps!

Yes you are correct and i have in my main folder sub folders that’s why i was using for each folder so it can loop from all folders not only one or i don’t need this ?

Hey i just tested it and it’s working as intended it’s reading every pdf in every folder and it’s outping txt in that folder.

My first assign is : Directory.GetFiles(“path to main directory where are all subfolders”, “*.pdf”, SearchOption.AllDirectories)

If it can be optimized i’m up.

Thanks for help.

1 Like

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