Last active
October 9, 2018 15:39
-
-
Save pgorczak/c2f70e603e4edff0115542508af971cb to your computer and use it in GitHub Desktop.
Simplest script that auto-syncs a folder to a remote destination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Args: source destination | |
# Needs rsync and inotify-tools | |
# Hidden files and folders are excluded via regex (inotifywait) and patterns (rsync) | |
while true; do | |
rsync -avz --exclude ".*" --exclude ".*/" $1 $2 | |
inotifywait -r -e modify,attrib,close_write,move,create,delete --exclude="\/\." $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment