Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a rather simple problem. I have a lot of PDFs that I want to compress, all grouped by college class. I don't have the time or energy to manually run the compress command when I know I can automate the whole thing.

However, I don't want to change the names of the files; how can I use pdftk compress an entire folder's PDFs and place the compressed versions in another folder?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

in linux you can simply use these few lines of script:

mkdir compressed
for f in *.pdf; do pdftk $f output compressed/$f compress; done
exit 0
share|improve this answer
Thanks! (Also, a quick Google tells me that for files with spaces, surround $f in quotes.) – JesseTG Aug 31 '12 at 17:32

Your Answer


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.