From: Simon Ruderich Date: Sat, 7 Dec 2013 20:22:15 +0000 (+0100) Subject: bin/srsync-incremental: Improve --link-dest search. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=8f71f32aa3e89e59258a90b93c79a7280397e8c5;p=config%2Fdotfiles.git bin/srsync-incremental: Improve --link-dest search. --- diff --git a/bin/srsync-incremental b/bin/srsync-incremental index 909c028..16aa88a 100755 --- a/bin/srsync-incremental +++ b/bin/srsync-incremental @@ -34,11 +34,11 @@ fi cd "$1" || exit 1 shift -dest=`echo backup-*` -if test "x$dest" != 'xbackup-*'; then - # -F and grep is used to list only directories, zsh's *(/) would be great. - dest="`pwd`/`ls -1dF backup-* | grep / | tail -n1`" -fi +# Get absolute path to last backup directory. +for x in backup-*; do + test -d "$x" || continue + dest="../$x" # relative to destination directory +done target=backup-`date '+%Y-%m-%d-%H-%M-%S'`