Skip to main content
Participant
April 15, 2020
Question

Is there a way to attach all files in a specific folder to the current PDF?

  • April 15, 2020
  • 1 reply
  • 387 views

Hello all. I am trying to figure out if there is a way to attach all the files in a particular folder using javascript on the Windows platform. My place of work was always paper driven but with the recent events we have transitioned to an almost fully electronic process. I have already utilized some custom dialogs and dynamic stamps in my workflow (Many thanks to @110714_Parker and @try67. I don't know how many times where I was stuck and it was one of your comment threads which got me back on track . You guys are a great resource.) which I have used to automate a lot of our processes before this pandemic and now the rest of the office is following suit. 

 

 My use case is as follows.

The Todays work folder is my virtual desk. I keep all my current project files in here. When I am done I  have to attach everything to the main PDF file. The issue is that I do not know what the attached files names will be ahead of time. They change with every project. Right now I just drag and drop them which works fine but if I can just automate the process that would be even better. 

 

The folder will always be the same. 

The filename changes.

The number of files change

 

I have no problem importing a single file at a time using the below code.

this.importDataObject("test","/c/Users/painterboy/Desktop/Todays work/filename.pdf");

Of course this only works if I know the filename ahead of time. 

I am also aware I need a priveleged function (not an issue)

 

So in pseudocode:

I need to open  the folder

Get the names and number of files. (Which will always be PDF)

Loop through them and attach them to the working PDF. Which is also in the same folder.

 

Seems like it should be simple enough but I can't figure it out. I have done hours of googling but nothing that fits my exact use case.

Can anyone point me in the right direction?

 

thanks in advance.

 

Painterboy

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
April 15, 2020

That is not possible in Acrobat, unless you collect the file-paths using an Action or they are known in advance, or follow a specific pattern.

Participant
April 15, 2020

Hmmm, darn. I was afraid of that. I guess I will just stick to dragging and dropping for the moment.

 

Thanks for the reply 🙂