3

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?

1 Answer 1

5

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
2
  • Thanks! (Also, a quick Google tells me that for files with spaces, surround $f in quotes.)
    – JesseTG
    Aug 31, 2012 at 17:32
  • This does not compress. Just moves the file.
    – wbad
    Jan 6, 2019 at 19:00

You must log in to answer this question.

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