Merging 1000 pdfs
I have about a thousand single page pdfs, and I want to merge them into one. I saw the standard gs and pdf2ps ways, but to do it for 1000 files is tiresome. So is there some neat trick which can do this?
The files are already numbered from 00000 to 01xxx.
If you know how to do it on the command line, there has to be a way to script it ;)
What have you got so far?
The thing is, you can just 'cat x.ps y.ps xy.ps'. But I want to do this recursively, and i don't know shell scripting. If you could just point me to a command that can increment filenames, i can do the rest.
Ok, I tried this. I seem to have made some syntax error, because its not evaluating the find expression. Hence the error.
ps2pdf 'find /home/Karthik/eBooks/ "*".pdf'
Error: /undefinedfilename in (find /home/Karthik/eBooks/ "*".pdf)
What's the right syntax?
Right I'm not at a Linux terminal now, but if you can just cat the PS files together beforehand and the files don't have any special characters or spaces in them this could be quite easy. If you run the ls command on that directory, do they come out in the right order? Also they are .ps files to begin with?
I hope this doesn't exceed the length for a bash command :!:
If so, try this :-
This is all just worked out here, make sure to back up before trying etc. Also this really only applies to your situation if you plan on running this often I'd recommend getting some error checking built into there. Good luck :D
cat $(ls *.ps) > master.ps
Sorry, that was a typo. The files are in pdf, I'm trying to convert it to ps so that I can use cat. I still can't figure out how to convert the lot to ps.
Your script doesn't seem to be working. I tried it on 2 ps files, but I got only the first one in the output.
Oh and yes, when I run ls, they do come out in the right order.
pdf2ps is the current problem.
Can I use ls's output as the filename for pdf2ps? What's the right syntax?
I found pdftk, but I'm getting error messages, the pdfs seem to be corrupt. Looking at ways of ignoring this. Thanks for the help @bigtomrodney