Last active
August 29, 2015 13:56
-
-
Save brennanMKE/8813105 to your computer and use it in GitHub Desktop.
Backup to thumbdrive on a Mac which ignores folders which do not need a backup like Dropbox and GitHub
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/sh | |
# set the strict mode | |
set -e | |
if [ -d "/Volumes/Thumbdrive" ]; then | |
if [ ! -d "/Volumes/Thumbdrive/Backups" ]; then | |
mkdir "/Volumes/Thumbdrive/Backups" | |
fi | |
if [ ! -d "/Volumes/Thumbdrive/Backups/MacBook Pro" ]; then | |
mkdir "/Volumes/Thumbdrive/Backups/MacBook Pro" | |
fi | |
rsync -av \ | |
-del \ | |
--exclude "/Documents/VMware/" \ | |
--exclude "/Documents/Projects/GitHub/" \ | |
--exclude "/Documents/Projects/Subversion/" \ | |
--exclude "/Downloads/" \ | |
--exclude "/Dropbox/" \ | |
--exclude "/Library/" \ | |
--exclude "/Music/" \ | |
--exclude ".DS_Store" \ | |
--exclude "/.vagrant.d" \ | |
--exclude "/.Trash" \ | |
--exclude "/.gem" \ | |
--exclude "/.dropbox" \ | |
--exclude "/.cocoapods/" \ | |
~/ "/Volumes/Thumbdrive/Backups/MacBook Pro/" | |
ls -lsa "/Volumes/Thumbdrive/Backups" | |
else | |
echo "Thumbdrive is not connected" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment