Last active
August 7, 2024 13:34
-
-
Save lopes/5702664 to your computer and use it in GitHub Desktop.
Packs an entire directory by zipping and encrypting it. #shell #shellscript #cryptography #files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#pack.sh | |
# | |
# Zips and crypts a directory. | |
# | |
# TODO | |
# - Ask confirmation before delete. | |
## | |
OUTPUT="$(basename $(pwd))" #current dirname | |
cd .. | |
tar -czvf "${OUTPUT}.tgz" "${OUTPUT}" | |
gpg --symmetric --cipher-algo aes256 "${OUTPUT}.tgz" | |
if [ "$?" == "0" ]; then | |
rm -rf "${OUTPUT}.tgz" | |
echo "REMEMBER TO DELETE THE ORIGINAL FILES!" | |
fi | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment