Check for PDF files in a folder, rename them based on the information inside the file, move them to a new folder

Hi all, newbie here and still in the dark on how to do the following. How can I check for pdf files in a folder, open the pdf files and capture the header information (i.e. Invoice number), rename the pdf file by adding the invoice number as the prefix of the file name, moving the renamed file to a new folder. Any help is appreciated in guiding me how to do it. Thanks all…

@Vher

Please follow below steps to do this.

  1. Use below expression to read all pdf files from particular folder and will give output as array of string.

                     arrPdfFiles [ ] =  Directory.GetFiles("input folder path","*.pdf")
    
  2. Then use ForEach loop activity to iterate one by one pdf file.

                ForEach item in arrPdfFiles
                       - Use Read PDF text activity to read the pdf file and save the output in one string variable
                       - And then use Regular expression or string manipulation functions to fetch invoice number from it.
                       - Finally use Move File activity to move file.
    

Source: item
Destination: “Destination folder path”+invoiceNumber+"*.pdf"

1 Like

“you can use UiPath Document OCR and document understanding to extract text from PDF. Once the text is extracted you can use rename file activity.
watch this video to know exactly how to extract text using UiPath Document understanding.
https://www.youtube.com/watch?v=6PNvWHzwZ8Q

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