Skip to content

Instantly share code, notes, and snippets.

@xcodebuild
Created December 2, 2015 08:36
Show Gist options
  • Save xcodebuild/85494ead99551ae93ad4 to your computer and use it in GitHub Desktop.
Save xcodebuild/85494ead99551ae93ad4 to your computer and use it in GitHub Desktop.
fswatch + rsync.
#!/usr/bin/env sh
#
# Description:
# Make your local folder to remote server synchronization.
# Requirements:
# brew install fswatch
SRC=/Users/liuxd/Documents/guess_cheat_new/
DES=liuxidong@172.16.0.37:/home/liuxidong/project/cheat/
EXCLUDE=/Users/liuxd/Downloads/rsync-exlcude.txt
fswatch $SRC | while read ev
do
if [ -e $ev ];then
rsync -av --delete --exclude-from=$EXCLUDE $SRC $DES
fi
done
# end of this file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment