Skip to content

Instantly share code, notes, and snippets.

@micalm
Created October 10, 2018 08:47
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 micalm/461da27cccff89c4e1da70bb6fc6c8f4 to your computer and use it in GitHub Desktop.
Save micalm/461da27cccff89c4e1da70bb6fc6c8f4 to your computer and use it in GitHub Desktop.
Encrypt all files in current folder with passphrase
#!/usr/bin/env bash
PASS="$1"
CIPHER="AES256"
for filename in ./*; do
encoded="$filename.asc"
echo "Encoding $filename..."
gpg \
--passphrase "$PASS" \
--output "$encoded" \
--cipher-algo "$CIPHER" \
--batch \
--symmetric \
"$filename" \
&& echo "Encoded $encoded!" \
|| echo "Failed $filename."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment