Skip to content

Instantly share code, notes, and snippets.

@afoeder
Forked from okvv/decrypt-pdf.sh
Last active May 25, 2026 13:58
Show Gist options
  • Select an option

  • Save afoeder/250260f8d01ab096ad43917754bd8ae4 to your computer and use it in GitHub Desktop.

Select an option

Save afoeder/250260f8d01ab096ad43917754bd8ae4 to your computer and use it in GitHub Desktop.
bash script to bulk remove password from (pdf) files in current directory using qpdf
#!/usr/bin/env bash
read -rsp "PDF password: " password
echo
for f in *pdf
do
qpdf --password="$password" --decrypt --replace-input "$f";
done
# brew install qpdf
# for executable file run: chmod u+x decrypt-pdf.sh
# storing them in a subfolder "decrypted/": `qpdf --password="$password" --decrypt "$f" "decrypted/$f"`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment