Acrobat JS has no access to the file-system in this way. You can't get a list of files in a folder, or even the list of folders.
thanks for the answer, i try to explain my problem.
i've just created an action, to process files from a specific folder(A).
For each file in this folder i want want to append another pdf from another specific folder (B) if the name of the files is the same.
I tried to combine file without asking the user but is not what i need to do, because i can't combine always with the same file (B) with every file in folder (A).
So you have files (say, 1.pdf, 2.pdf, 3.pdf) in folder A and you want to know if there are files in the same name in folder B?
You can't do it directly. You can try to open the files in folder B (or insert them into the files in folder A) and see if that works.
If no file is opened (or inserted) then you know they don't exist.
i know in folder A are:
in folder B i have:
I need to append 1.pdf in B folder at the end of 1.pdf in A folder and so on.
I need to do this often for a lot of files.
i have found:
but my question was how to get files in B folder, my action is looping A folder.
I really appreciate your help, thanks for your patience.
You don't need to get the files in folder B, if you know what the path of folder B is and what the file names are...
To process multiple files you need to use an Action in Acrobat Pro. Have it execute the following JS code (let's assume that folder B is actually C:\Temp\B\):
var folderBPath = "/c/temp/b/";
Then add a Save command, and you're done.
Thanks for your help, i think this is the right way, i tried this:
var A4FileName = this.documentFileName.replace(/\.pdf$/i, "") + ".pdf";
var folderBPath = "/c/Users/a.delia/Desktop/A4/";
But the saved file at the end of the action does not contain the new pdf in append of the processed.
Is the syntax correct?
It seems OK, although I don't understand what you tried to do in the first line of the code... Why are you removing the ".pdf" extension and then adding it back again? What's the point of that?
Also, check the JS console for any error messages after you run the Action.
I remove the extension because i'm also trying to do this converting from a tif file to a merged pdf with the tiff and the pdf with the same name.
I think the correct code could be this:
var A4FileName = this.documentFileName.replace(/\.tif$/i, "") + ".pdf";
i do this for define the correct name of the second file.
But it does not work again.
You can't do both things in a single Action. You have to first convert the
TIFF files to PDFs, and then insert those PDFs into the other files.
On Thu, Jul 16, 2015 at 11:05 AM, alessandrod39500986 <
- The first take all tif in folder and generate in another folder the pdfs.
- the second take these pdfs and append another pdf to my final file.
Thanks for your help.
Also: check the console. Any errors?
Also: check the documentation of insertPages, it isn't clear to me where the new pages will be inserted, so best to specify.