Skip to content

Instantly share code, notes, and snippets.

@zipizap
Created September 3, 2010 19:32
Show Gist options
  • Save zipizap/564419 to your computer and use it in GitHub Desktop.
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
#!/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