Skip to content

Instantly share code, notes, and snippets.

@morgner
Created November 17, 2010 09:02
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 morgner/703172 to your computer and use it in GitHub Desktop.
Save morgner/703172 to your computer and use it in GitHub Desktop.
Synchronize DIRECTORY from a VOLUME to the scripts location by script name, (here for OSX: look at SRC)
#! /usr/bin/env bash
VOL=${0##*_}
DIR=${0%%_*}
SRC="/Volumes/${VOL%.*}/${DIR##*/}"
if [ -d "${SRC}" ]
then
rsync -ah -x --delete --stats --progress --exclude='.DS_Store' "${SRC}" "${0%/*}"
else
echo "ERROR: Directory '${SRC}' not found"
read -sn1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment