Skip to content

Instantly share code, notes, and snippets.

@dsecuma
Last active February 4, 2021 06:16
Show Gist options
  • Save dsecuma/fa0a8c657feb477aa77c107331e5470c to your computer and use it in GitHub Desktop.
Save dsecuma/fa0a8c657feb477aa77c107331e5470c to your computer and use it in GitHub Desktop.
Poor script to encrypt all pdf in specific folder with AES256 (qpdf)
#!/bin/sh
stty -echo
while true; do
read -s -p "Password: " password
echo
read -s -p "Password (again): " password2
echo
[ "$password" = "$password2" ] && break
echo "Please try again"
done
stty echo
for file in $1/*.pdf ; do
qpdf --encrypt $password $password 256 -- $file ${file%.pdf}-enc.pdf
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment