Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1931
  • Last Modified:

How to merge multiple pdfs based on file names?

Hi,

I have about 10 folders containing some pdfs that I need to merge based on the file name. The naming convention is like "acctnumber_12345.pdf" and each acctnumber has multiple pdfs associated with it. I want to merge everything for each account under a new name convention "acctnumber.pdf". Is there a script or any easy way to get it done? FYI, I'm using a Windows OS and I have thousands of files.
0
bpatton_psr
Asked:
bpatton_psr
1 Solution
 
jawa29Commented:
Hi bpatton_psr

The first question is... Do you own a copy of Acrobat Pro?

If the answer is yes then you have an easy solution, well easy but a little time consuming.

You can open one of the files in Acrobat Pro and then Select Document\Insert Pages\From File (Shift + Ctrl + I) From this window you can multi select the files you want to merge, on the next screen select where in the document you want them to go (normally at the end).

Job Done

Your other option is to go for something like activePDF http://www.activepdf.com/products/

Their script to merge files
http://www.activepdf.com/support/knowledgebase/viewKb.cfm?id=10678&tk=sp

Jawa29

0
 
RobSampsonCommented:
Hi, using PDFTK:
http://www.pdflabs.com/docs/pdftk-cli-examples/

you can run
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

to concatenate 1.pdf, 2.pdf, and 3.pdf as 123.pdf

To help you script this further, I'll need more details on what your files are.  Please provide some exact file names before and after, and I'll knock up a script.

Regards,

Rob.
0
 
bpatton_psrAuthor Commented:
Here's what we did:

@echo off 

for /f "tokens=1,2 delims=_" %%a in ('dir *.pdf /b') do ( 
md "%%a" 2>nul 
move "%%a_%%b" ".\%%a\" >nul 
) 
for /f "delims=" %%a in ('dir /a:d /b') do ( 
copy /b "%%a\*.*" "%%a.pdf" 
) 

Open in new window

0
 
bpatton_psrAuthor Commented:
Was looking for a batch script. We had thousands of PDFs and we found this script online. Modified it a little bit to our solution. Worked! Thanks to all for suggestions though.
0
 
KHMaddoxCommented:
bpatton_psr
I am having the same issue but I have no experience creating or using scripts.
Any advice how to accomplish this or do you perhaps know of a program that does this?
-kitmaddox@yahoo.com
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now