Decrypt all PDF's in a Directory

I recently had to decrypt a bunch of PDF's. I knew the password, but didn't want to do them one at a time. Luckily, some quick scripting did the trick.

brew update && brew install qpdf  

Fire up your favorite text editor (I named the file



for f in *.pdf  
    qpdf --decrypt --password="$1" "$f" "$DECRYPTED_FOLDER/$f"

Give it some power: chmod +x

Make sure the script is in the same directory as the PDF's you want to convert. It'll make a new directory called "decrypted" and dump the PDF's into it.

./ pdfPasswordHere

For example:

./ awesomesauce

Enjoy decrypting!