=== added file 'snaprep' --- snaprep 1970-01-01 00:00:00 +0000 +++ snaprep 2013-11-01 23:01:04 +0000 @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ $# -ne 2 ]; then + echo "usage: snaprep src_dir [user@]dst_host:dst_dir" +fi + +remote="${2%%:*}" +remote_basedir="${2#*:}" + +rsync_list() { + rsync --list-only --dirs --8-bit-output "$@" | sed 's/^.......................................... //' +} +remote_snaps="$(rsync_list)" + +for local_snap in "$1"/*; do + if [ -d "$snap" ] && ! grep -qFe "$snap" <<<"$remote_snaps" ; then + ssh remote snapclone "$remote_basedir/$snap" + fi +done