Skip to content

Instantly share code, notes, and snippets.

@ahebrank
Created November 30, 2017 18:32
Show Gist options
  • Select an option

  • Save ahebrank/7cf353d1fb1a52e3c5735adf8de13d3f to your computer and use it in GitHub Desktop.

Select an option

Save ahebrank/7cf353d1fb1a52e3c5735adf8de13d3f to your computer and use it in GitHub Desktop.
mirror files from one place to another while you're working on them (e.g., plugin development with live testing on a site using it)
#!/bin/bash
CMD="notifyloop"
function show_help() {
echo "$0 [SRC] DEST"
echo " SRC and DEST are anything recognizable to rsync"
echo " if unspecified, SRC is pwd"
}
command -v $CMD >/dev/null 2>&1 || {
echo >&2 "I require notifyloop but it's not installed. Try 'brew install fsevents-tools'."
exit 1
}
if [ $# -eq 2 ]; then
SRC=$1
DEST=$2
elif [ $# -eq 1 ]; then
SRC="$( pwd )/"
DEST=$1
else
show_help
exit 1
fi
echo "Syncing $SRC to $DEST. Control-c to break."
notifyloop . rsync -avz --exclude=".git" $SRC $DEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment