Skip to content

Instantly share code, notes, and snippets.

@tureki
Last active May 24, 2023 19:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tureki/10851084 to your computer and use it in GitHub Desktop.
Save tureki/10851084 to your computer and use it in GitHub Desktop.
Rsync when file changes on Mac
#!/bin/bash
#install fswatch
brew install fswatch
#fswatch to keep a directory in sync with other directory
fswatch-run /Users/tureki/Desktop/files/ /Users/tureki/sh/rsync.sh
#!/bin/bash
#rsync file to samba volumes
rsync -rlHpogDtS --delete /Users/tureki/Desktop/files/ /Volumes/tureki/files/
#rsync file to remote server
rsync -rlHpogDtS -e ssh --delete /Users/tureki/Desktop/files/ HOSTNAME:~/files/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment