Copy link to clipboard
Copied
Hi all
I have many (approx. 100) folders with many (between 2 to 200) . pdf files inside.
I need the content of each folder to be merged (combine) into a single .pdf per folder.
Thought this should be easy (I write scripts for InDesign). So far... I have no idea how this works in Acrobat.
Extra difficulty: I work on MacOS, my client is on Windows.
I was hoping to create an Action that could be exported and imported at clients site.
I would appreciate any input. Thank you very much.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
OK. This sounds good.
Step 1, the Action. How do I travers the content of the source folder, that is collect the many paths to the jobfolders?
I would usually have a loop within a loop. The inner loop collecting all the files and doing the merge. The outer loop traversing over all the jobfolders.
Maybe have more detailed advice. Thank you very much!
Copy link to clipboard
Copied
That's what the Action does for you. You can't use a loop because you can't access the files in the folder using JS. You need to run the Action on the folder in question and then use the script to keep an in-memory copy of the path for each file. Then you use those paths to merge the files in a separate script.
That's basically what I did in this (paid-for) tool I've created that does just that:
https://www.try67.com/tool/acrobat-batch-combine-all-pdf-files-in-a-folder
Copy link to clipboard
Copied
The Action will travers the source folder and the subfolders for you.
Copy link to clipboard
Copied
Be aware, though, that it will also convert any non-PDF files to PDF (if it can), so make sure your folder only contains PDFs before running it.
Copy link to clipboard
Copied
OK. I am trying to create an Action. I am in the "Edit Action" window. I tried a few things... I don't get it. What would I do? Most fitting thing would be "Document Processing"... There is an element called Add Folder already present in the new Action. I choosen my Source Folder... Can not save this. I clearly don't understand how this should be done. Any help very much appreciated.
Copy link to clipboard
Copied
Do you know how to write scripts for Acrobat using JS? Because if not, this is the least of your worries, as it's not a trivial scripting task.
Copy link to clipboard
Copied
Happy to jump!
Copy link to clipboard
Copied
would be usefull to have a simple script example
can you point me in the right direction?
Copy link to clipboard
Copied
Example for the output in the Javascript console:
console.println(this.path);
Copy link to clipboard
Copied
Hello again. Not going anywhere fast here. So I am cycling through the "Source" folder and find all the files in all subfolders. The GUI only allows only for a merge (combine files) when choosing the files at the start. And that would be a manual action...
Can you provide more hints?
Copy link to clipboard
Copied
File structure