X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fsrsync-incremental;h=16aa88a0215f3db4cb4d231bc212bbf3bd783135;hb=8f71f32aa3e89e59258a90b93c79a7280397e8c5;hp=909c028802032b5679321c7dcc53e0a83518c1a2;hpb=4453828578cf549be4354479f826a2336c3697ad;p=config%2Fdotfiles.git 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'`