From e76bdf9a32719561b80ae1bb7e97cc48d691a1c2 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 4 Nov 2017 13:25:51 +0000 Subject: [PATCH] add autosync util --- sh/autosync | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sh/autosync diff --git a/sh/autosync b/sh/autosync new file mode 100644 index 0000000..c0867e1 --- /dev/null +++ b/sh/autosync @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh +autosync() { + target="$1" + shift + # as a reminder not to get the argument order mixed up: + echo -E "rsyncing to $target" >&2 + while inotifywait -q -e create,modify "$@"; do + \rsync -rtl "$@" "$target" + done +}