Created
September 7, 2011 15:55
-
-
Save LukeChannings/1200956 to your computer and use it in GitHub Desktop.
Synchronise USB Stick when inserted OS X.
This file contains hidden or 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 | |
# Mount the volume. | |
/sbin/mount_msdos.real "$@" | |
# MODIFY TO FIT YOUR NEEDS. | |
LABEL="HUBBLE" # USB Stick Label. | |
USBFOLDER="College Work" # Name of the folder on the USB Stick. (Can be a relative path.) | |
DESTINATION="/Volumes/Media/Dropbox/College Work" # Folder to which the USB Stick will be synchronised. | |
# DO NOT EDIT BELOW THIS LINE. | |
sleep 3 # Wait a bit for the USB Stick to be mounted. | |
# Check that the USB Stick is there.. | |
if [ -d "/Volumes/$LABEL" ]; then | |
say "Synchronizing your USB Stick." | |
# Rsync | |
rsync -auv "/Volumes/$LABEL/$USBFOLDER/" "$DESTINATION/" | |
rsync -auv "$DESTINATION/" "/Volumes/$LABEL/$USBFOLDER/" | |
say "Synchronization complete." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment