Created
September 3, 2010 19:32
-
-
Save zipizap/564419 to your computer and use it in GitHub Desktop.
Backs up the current directory, in a ZIP file to the HOME folder. Run the script inside the directory that you want to backup
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 | |
CURR_DIR="$(basename $PWD)" | |
BCKP_FILE="$HOME"/"$CURR_DIR""_Backup_""$(date +%F_%T)"".zip" | |
echo "..Starting executing" | |
echo "..Going to backup the current directory ('$CURR_DIR') into" | |
echo " $BCKP_FILE" | |
echo -n "---> Continue [Y/n] ? " && read CONTINUE | |
[ -z "$(echo $CONTINUE| grep -i 'y')" ] && echo "..Aborting" && exit 1 | |
cd .. && zip -9r $BCKP_FILE "$CURR_DIR" | sed -u 's/^/.... /g' | |
echo "..Finished - check $BCKP_FILE" | |
echo "" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment