5 Replies Latest reply on Jan 24, 2018 9:32 AM by Tbadobe

    Merge by Name


      hello all,


      I have scoured the internet trying to figure out how to quickly merge files with the same unique identifier. I have 5000 files and there files are named As follows:








      1. Is there a way to combined the files by unique identifier? Combined file 1 would have the three files from above that have this prefix (5772000001) and the two files that have the prefix (57720000012)


      2. Is there a way to saved the combined files to a folder that has that same prefix?


      Any help would be greatly appreciated.

        • 1. Re: Merge by Name
          Thom Parker Adobe Community Professional

          This is a tricky one.  If you knew the file names and folder ahead of time you could do this with an automation script.


          But a more general solution would be to use a script in an Action.  An Action script is run each time a new file is loaded into the Action. The script doesn't know if it's the first or the last file so the first thing it needs to do is look for an already open merge file, if this file does not exist it creates a new one page PDF. If the merge PDF does exist, then it inserts the new file into the merge PDF.  As well as creating the Merge PDF, the script would also need to collect information from the user about the target file names. And there is an ordering issue. The files are not loaded into the Action in any predicable order. So if ordering is needed, there has to be some way to sort the files for inserting.

          • 2. Re: Merge by Name
            Karl Heinz Kremer Adobe Community Professional

            Thom gave you an outline of how to do this within Acrobat. As you can see, it’s not straight forward. For cases like this, I prefer an approach that uses both Actobat to do the heavy PDF lifting and an application outside of Acrobat that handles the interaction with the user, reading of directories, and sorting filenames. You can e.g. program in VB or VBA (especially if you want to process information that comes from a spreadsheet) to do all file system operatione, and then use Acrobat’s IAC Interface to process the merging of PDF files.

            1 person found this helpful
            • 3. Re: Merge by Name
              Tbadobe Level 1

              Karl and Thom, thank you so much for your guidance. Good place to start.


              The interaction part is less of a worry. I thought there would be a script that would be able to handle the file merge for related names.



              Thom, I have the file names and folder names. Is there a quicker approach per your first paragraph.

              • 4. Re: Merge by Name
                Thom Parker Adobe Community Professional

                Yes, if you know the name and location of the files you can write a short script to loop through the names and insert the files into a merged file.


                Something like:


                var oMergeDoc = new Doc();


                     oMergeDoc.insertPages(oMergeDoc.numPages-1, <Path to File>);

                • 5. Re: Merge by Name
                  Tbadobe Level 1

                  Thank you, Thom! I appreciate your help a great deal!