Read multiple folders and pdf files

Dear Team,

Please help me in this usecase

We have multiple folders which contains two pdfs(one old, one new)…we have to pick one folder , compare the 2 pdfs using (Compare PDF & Word Documents Online - Draftable)…once done we have to save the result and pick another folder and compare the pdfs inside it…so on

please guide me

Hy @kshenam, welcome to the UiPath Community!

To achieve what you want:

  • Create an Array of Strings variable to loop through all folders inside your folders parameters
  • Loop through the files inside each folder
  • run the comparison
  • Record the result

I will prepare an workflow and uploaded it to you :slight_smile:

Regards

1 Like

Hi @kshenam,

Welcome to the community forum :wink:
As I understand it you are having one master directory, with several subdirectories containing the pdf files right?
E.g.:

  • Master directory
    • Sub directory 1
      *PDF old
      *PDF new
    • Sub directory 2
      *PDF old
      *PDF new
    • Sub directory 3
      *PDF old
      *PDF new

and you wish to compare these using your website there.

Here is how I would do it.

  1. Get a list with all the sub directories
  2. For each Sub directory, get a list of the items in the sub directory
  3. Read the name of the pdf file and determine which is old and which new
    1. Click on the website ‘choose file’ and upload the old pdf file to the website using the file path
    2. Click on the website ‘choose file’ and upload the new pdf file to the website using the file path

To get the following list I would use the following syntax:

  1. listOfSubDirectories = Directory.GetDirectories("Path of the master directory")
  2. For Each dirFile In listOfSubDirectories 
         subOutput = Directory.GetFiles(dirFile)
         For Each pdfFile In listOfSubDirectories 
            if pdfFile.Contains("Old") then
               workflow to click 'choose file' in the 'old' option and type pdfFile into file path
            else:
               workflow to click 'choose file' in the 'new' option and type pdfFile into file path
            end if
         Next 
    Next
    

step 2 also includes the sytax for step 3

I hope this helps you in the right direction :smiley:

3 Likes

Hy @kshenam,

Please have a look at my workflow.

As I saw, this site just opens 2 pdfs side y side, it does not compare the pdfs itselft.

Have a look

Happy automation
ComparePDFs_Test.zip (409.7 KB)

Dear William , Thanks

…We could not able to read files inside sub folder!

Hy @kshenam,

Take a look at this file, it is a bit different than the previous one, it has nothing to do with the website

LoopThroughFoldersAndFiles.zip (357.3 KB)

1 Like

Dear , You are really awesome and many thanks

now my use case changed …

1.Open foxit pdf
2.Click on View->Compare
3.One dialogue button will appear …chose old file by clicking on button…then chose new file by clicking on button…
4.click on compare button and save it
5.Next go to other files on another folders and save the comparison

pls suggest workflow

1 Like

Hy @kshenam,

Very glad I could help you. Please like my post and mark my answer as a solution!

In the case of comparing the pdfs I believe there is no automation to be made, as there comparison must be made yourself.

PS: Please TAG me in your answer so I get notified.

Regards

1 Like

Hy @kshenam

Thank you very much for the like for the like, but you forgot to mark my post a solution :slight_smile:
image

Thank you

Hello team,

I am in middle of a project wherein I have a huge stock of pdfs in a folder and i need to count the number of pages in it, and how many pages are blank and Also after the above request is done this needs to be written in an excel wirh column, 1.file name(pdf name), 2. Number of pages in the pdf, 3. Number of blank pages in a pdf

Need help

Hi @William_Blech_Sister,
Really appreciate ur help. I’m also facing a similar problem, requiring to open files from multiple sub folder. I have seen ur workflow but I do not really understand (I have no IT background and just started). Is it possible for u to do a tutorial for me please :pleading_face:.