Skip to content

Instantly share code, notes, and snippets.

@DeanF
Last active March 8, 2017 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeanF/26e7aa81572fe148eff9726efb451189 to your computer and use it in GitHub Desktop.
Save DeanF/26e7aa81572fe148eff9726efb451189 to your computer and use it in GitHub Desktop.
Unlocks all pdfs in a folder using pdftk
#!/bin/bash
for filename in *.pdf; do
pdftk $filename input_pw $1 output "$filename.tmp.pdf"
if [ $? -eq 0 ]; then
rm "$filename"
mv "$filename.tmp.pdf" "$filename"
touch "${filename}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment