Skip to content

Instantly share code, notes, and snippets.

@JPvRiel
Created November 12, 2017 19:56
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 JPvRiel/5525f56080f6068d9039f7fb3ba23fb1 to your computer and use it in GitHub Desktop.
Save JPvRiel/5525f56080f6068d9039f7fb3ba23fb1 to your computer and use it in GitHub Desktop.
Decrypt a directory of PDFs using bash, basename and qpdf

Given a working directory and a folder c with encrypted PDFs, use qpdf, basename and a bash loop:

for f in c/*.pdf; do qpdf --password=<password> --decrypt $f "$(basename -s .pdf $f).pdf"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment