Link to home
Start Free TrialLog in
Avatar of E=mc2
E=mc2Flag for Canada

asked on

script to join pdfs

I am looking for a script I can simply double click on, and it will join 2 pdfs that end with A.pdf and Q.pdf.
For instance in folder c:\files\... I have many files.
for example..

12345A.pdf
12345Q.pdf
75123R.pdf
45212R.pdf
78787.Q.pdf

When is looks in this folder it will take file 12345A.pdf and file 12345Q.pdf and join them to form 12345.pdf
And it will delete 12345A.pdf and 12345Q.pdf

The script needs to look through the list and see if there are 2 same prefixes, however one ending with A.pdf and the other ending with Q.pdf and then join them.

I believe pdftk server will allow for joining however I am not sure if it can get this granular.

Thanks for your help.
SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Joe Winograd
Hi Pawan,
Thank you for the reference to my post — much appreciated — although the more relevant part for this question occurs later in that thread where it talks about merging files that have matching initial characters. Regards, Joe
Avatar of E=mc2

ASKER

Thanks to you both.  Is what I am looking for possible?
> Is what I am looking for possible?

Yes! Do all of the file names have just five characters before the A and Q? Are the characters before the A and Q always digits (numbers)? I'm leaving my office now for an hour or two and will check back for your answers to those questions when I return. Regards, Joe
Avatar of E=mc2

ASKER

Thanks Joe, yes all the files have 5 characters, and the digits before the A and Q are always numbers.  Thanks so much.
> yes all the files have 5 characters, and the digits before the A and Q are always numbers

Another question: are there any files with the same five leading digits but do not have an A or Q next? For example, could there be three files like this:

12345A.pdf
12345Q.pdf
12345W.pdf

Or will there always be just the two files (A and Q) with the same five leading digits, e.g.:

12345A.pdf
12345Q.pdf

Regards, Joe
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of E=mc2

ASKER

Hi Joe, thanks so much.  Yes, I would be willing to try.  thanks kindly.
You're welcome, 100questions. As I mentioned at your other similar question, I'm not ready yet for distribution of CAPTAIN to everyone on the Internet, so I sent you a PM via the EE Message system to discuss getting it to you on a test basis. Regards, Joe
Selected posts with reasons:

#a42388681: It's possible to make the code later in that thread work, so this post deserves credit.

#a42394779: I guarantee that the CAPTAIN program can do exactly what's requested in this question. The program has many users, all with the same requirement as this question, and all reporting success with it.

Splitting the points evenly between the two experts.