Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking for a script that can do the following:

I have

  • 500 pdf files with naming convention: SC####.pdf
  • 500 pdf files with naming convention: AB####.pdf

I want a batch file to check if there is a #### match between the 2 sets of files.

  • if there is, it will combine SCS####.pdf with AB####.pdf into a newly created file called ST####.pdf. (e.g. When you open file ST1099.pdf you see the contents of SC1099.pdf first, then AB1099.pdf contents second.)
  • if not , it saves a new file as ST####. (e.g. SC0123.pdf has no matching file of AB0123.pdf, so the contents of SC0123.pdf are copied to ST0123.pdf.)

All 500 of the ST#### files are to be saved into a different directory and transferred via FTP to a server. The original SC####.pdf & AB####.pdf should not be deleted.

Ideally, I would like to execute automatically on the 1st of every month.

share|improve this question
    
You would need a software that is capable of reading and writing PDF files, which is not as common as one would think. There might be some C++ or Java libraries out there that can do this, but trust me, it isn't a simple task. –  jcoc611 Jul 22 '12 at 1:28

1 Answer 1

Its possible using a tool called PDF Tool Kit. Download the tool and install, after that two pdf files can be joined using a command as follows:

pdftk A=SC1099.pdf AB1099.pdf cat output ST1099.pdf

This takes the files listed in A and concatenates them into output file ST1099.pdf.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.