Skip to main content
Inspiring
November 28, 2018
Answered

Opening several .PDFs located in different nested folders

  • November 28, 2018
  • 1 reply
  • 1046 views

I'm not sure if this would be the appropriate forum for this question so let me know if it's better to put it in another discussion board! My main concern is that this might be more easily done in Powershell, and I just don't want to go that route, I'd rather keep it contained within Acrobat so that If I'm not the person doing the paperwork then it's a bit less intimidating for less tech savvy folk who don't know what a terminal looks like.

I'm wanting to create a script I can run that would allow me to enter in names of several files and have Adobe open them all up either one by one or all at once. Here's the situation:

I have 6 folders, all of which have a dozen or more nested folders inside that are numbered, and tons of .PDFs inside those various child folders based on the .PDF name. These .PDFs have a naming convention according to which parent folder and child folder they're in, for example:

In folder 1, all .pdf names begin with "ES-" followed by a number 1-99, or 100-199, or...

in folder 2, all .pdf names begin with "FS-" followed by a number 1-99, or 100-199, or...

etc...

So the beginning of the name ("ES-") is determined by the parent folder and the number range is decided by the child folder.

I want to put some script together so I can choose which parent folder to start the search in via app.response prompt (or something equivalent) and then search for the numbers I input into a second prompt recursively so it can dig through the dozens of child folders and find the correct file.

This topic has been closed for replies.
Correct answer try67

A script can't open a file if it doesn't know its full path and name. So the only way to do what you describe is by trial-and-error, ie going over all the possible file-names and trying to open them, one by one. This is not a simple scripting task, but it's certainly doable.

Basically you just need to write a loop that goes over the file-names and then use the openDoc method to try and open them.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 28, 2018

A script can't open a file if it doesn't know its full path and name. So the only way to do what you describe is by trial-and-error, ie going over all the possible file-names and trying to open them, one by one. This is not a simple scripting task, but it's certainly doable.

Basically you just need to write a loop that goes over the file-names and then use the openDoc method to try and open them.

Inspiring
November 29, 2018

So there is no recursive search in acrobat's JS then? Bummer. To Powershell it is, then!

try67
Community Expert
Community Expert
November 29, 2018

There's no search, period.