Skip to content

Instantly share code, notes, and snippets.

@pzelasko
Last active October 3, 2018 12:06
Show Gist options
  • Save pzelasko/bd94447d5aa50e38cdc81c61926f946b to your computer and use it in GitHub Desktop.
Save pzelasko/bd94447d5aa50e38cdc81c61926f946b to your computer and use it in GitHub Desktop.
Shell utility for continuously synchronizing two directories (possibly local and remote)
#!/bin/sh
if [ $# -ne 2 ]; then
echo "Usage:"
echo "dirsync <source> <target>"
fi
while inotifywait -r -e modify,create,delete "$1"; do
rsync -avz "$1" "$2"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment