Skip to content

Instantly share code, notes, and snippets.

@SimplGy
Created May 8, 2015 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimplGy/7bfcc52732ecc0df1f66 to your computer and use it in GitHub Desktop.
Save SimplGy/7bfcc52732ecc0df1f66 to your computer and use it in GitHub Desktop.
Backs up your dropbox folder recursively and incrementally to a file named by the month and year. Meant to run as a cron job.
#!/bin/bash
echo "Starting Dropbox Backup"
echo "-----------------------"
echo `date`
cd ~
mkdir -p "Dropbox Backups"
echo "Archiving './Dropbox' to 'DropBox Backups/Dropbox_YEAR-MM).zip'.."
echo ""
# add --encrypt to pwd protect
zip -r --update --test "Dropbox Backups/Dropbox_$(date +"%Y-%m").zip" ./Dropbox
echo ""
echo ""
echo "Done Archiving."
echo ""
echo "Printing all empty folders in the '~/Dropbox' which are empty and not in a hidden folder."
echo "Be on the lookout for new empty ones, means Dropbox may be messed up:"
find ~/Dropbox -type d -empty -not -path '*/\.*'
echo ""
echo "Total empty folders:"
find ~/Dropbox -type d -empty -not -path '*/\.*' | wc -l
# find ~/Dropbox -type d -empty -not -path '*/\.*' | tee >(wc -l)
echo ""
echo ""
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment