Skip to content

Instantly share code, notes, and snippets.

@julcap
Created November 19, 2021 15:34
Show Gist options
  • Save julcap/b46b35a0e8012c9f5359519d9a3fba25 to your computer and use it in GitHub Desktop.
Save julcap/b46b35a0e8012c9f5359519d9a3fba25 to your computer and use it in GitHub Desktop.
Automation to enctrypt/decrypt folders
#!/usr/bin/env bash
if [ ! $1 ]; then
echo -e "Usage\n"
echo -e "$0 { FOLDER | ENCRYPTED FILE }\n"
exit
fi
if [ -d $1 ]; then
tar cz $1 | openssl enc -aes-256-cbc -pbkdf2 -e > $1.encrypted
else
openssl enc -aes-256-cbc -pbkdf2 -d -in $1 | tar xz
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment