Skip to content

Instantly share code, notes, and snippets.

@jonbalbarin
Created November 30, 2011 17:20
Show Gist options
  • Save jonbalbarin/1409879 to your computer and use it in GitHub Desktop.
Save jonbalbarin/1409879 to your computer and use it in GitHub Desktop.
a bash script for backing up the current directory to dropbox
#!/bin/bash
if [[ $1 ]]
then
BACKUP_ARCHIVE=$(basename $(pwd))_$(date "+%Y-%m-%d-%H%M%S")_\(${1// /-}\).tar.gz
echo "backing up to "$BACKUP_ARCHIVE
tar -czf $BACKUP_ARCHIVE .
cp -pv $BACKUP_ARCHIVE ~/Dropbox/Backups
rm -v $BACKUP_ARCHIVE
echo done
else
echo "usage!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment