Reading multiple pdf files and renamin them


I have a question. I am trying to create a robot that can read multiple pdf files and based on those files renaming them but each invidually… Can anyone help me with this? I am fairly new to UiPath.

With kind regards,


Hi @ukjtenhoven.

  1. Please use Directory.GetFiles(“folderPath”, “*.pdf”) and assign it to an array of string(let’s say arrVar as variable name)
  2. Use For Each to loop through the arrVar.
  3. Then use Move File activity to rename the files one by one (should be inside the loop)

Hope this helps. :slight_smile:


Hi @Jan_Brian_Despi,

Thanks for your reply. I sort of already made that, but here is the problem we need to scan files in the printer then the printer sends the scanned file to a special folder. But each scanned file has a different unique name. And also each scanned document is different for example: bills, contracts, etc. So the robot needs to read those files and rename them. But each file needs another name. And it needs to get the name based from that scanned file…

With kind regards,

1 Like

What will be the new file names?


Based from that file. see for example below.


But then differently for each file. It needs to retrieve the name from the scanned document.

With kind regards,

Hi @ukjtenhoven

Buddy, its easy ,

  1. once getting the files from the directory and using for each loop to iterate through the collections of filenames, open them using open application activity and mention the file path as input, because you need application to be opened to read pdf with get text…else you can use scrape method with ocr like screen scraping from design tab to get the name if the pdf is not native pdf( where you could not select the field )
  2. Then use get text activity to get the name from the document with which you can save the file
  3. assign that get text activity to a variable
  4. now use move file activity and enter the to destination property the filepath + that variable from assign activity + “.pdf”
  5. Thats all buddy you are all done…

Hope this would help you



hi @Palaniyappan,

Thanks for your help but I still have a few questions. Were talking about maybe 100+ different pdf files. so:

  • How will the get text activity decide for each different file a invidually name?
  • And could you perhaps share a example?

Right now I made a robot for one specific document. But it basically it needs to be for all the different files.

With kind regards,

1 Like

Thats a good question buddy…


  1. For first question, in that case we can use wildcard in selectors to get the same type of data but from different pdfs…to make it even more reliable we can use anchor base activity with a solid anchor on left side that remains same in all the file and we can use use get text activity as base in anchor base activity…but whatever may the file must be opened while using get text activity…

  2. Coming to second question, here is your example xaml buddy…
    wordpress.pdf (42.6 KB)
    Main.xaml (11.0 KB)
    well hear i didn’t use two files but you can by mentioning the file path in start process, btained from Directory.GetFiles(“folder path”,“.pdf”) assigned to a collection type variable

Hope this would help you…


Hi @Palaniyappan,

Thank you for your time and helping. But that is specific for that one sample.pdf right? Everytime the file is completely different. Here I made a robot for one specific file. But it needs to do it for different .pdf files. Do you have any idea how to achieve that?

GetName.xaml (7.5 KB)

With kind regards,

Buddy i think there is some issue with my studio in opening your xaml, can i have the full folder a zipped one…if possible

Sure! @Palaniyappan