Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 4 down vote accepted

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

#!/bin/bash
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .