0

I want to use pdftk to merge all pdffiles in a directory and all of its subdirectories. I cannot find a --recursive option in the man pages.

Doing this manually (using a GUI) is not an option as it would be too much work.

Any suggestions?

1

I don't think this is ideal, but you could:

  1. cp all the pdf files of the subdirectories into one directory.

    mkdir all-in-one
    find SomeDirectory -iname '*.pdf' -exec cp {} all-in-one/
    
  2. concatenate them

    cd all-in-one
    pdftk *.pdf output output.pdf
    

The disadvantage of this solution is that you have to copy all the files.

0

This doesn't like file names that include spaces, but it seemed to work for a couple files in two different directories. That is a back quote (same key as the tilde character) surrounding the find|xargs pipeline.

pdftk `find . -name *.pdf -print|xargs echo` cat output out.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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