Created
June 30, 2014 12:26
-
-
Save jonbalbarin/05f421fb93fa372e2654 to your computer and use it in GitHub Desktop.
compress current directory and move it to a backups folder in dropbox
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 | |
BASE_PATH=/tmp/$(basename $(pwd))_$(date "+%Y-%m-%d-%H%M%S") | |
if [ -z "$1" ]; then | |
BACKUP_ARCHIVE=$BASE_PATH.tar.gz | |
else | |
BACKUP_ARCHIVE="$BASE_PATH"_\(${1// /-}\).tar.gz | |
fi | |
echo "backing up to "$BACKUP_ARCHIVE | |
tar -czf $BACKUP_ARCHIVE . | |
mkdir -p ~/Dropbox/Backup | |
cp -pv $BACKUP_ARCHIVE ~/Dropbox/Backup | |
rm $BACKUP_ARCHIVE | |
echo done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment