From 0627246aa2b5db1320965061e517f65742be9d19 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 22 Jun 2017 14:52:01 +0200 Subject: [PATCH] bin/srsync-incremental: remove target directory if empty --- bin/srsync-incremental | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/srsync-incremental b/bin/srsync-incremental index 9ade4e4..187e6b6 100755 --- a/bin/srsync-incremental +++ b/bin/srsync-incremental @@ -59,4 +59,8 @@ rsync \ rmdir "$target_tmp" 2>/dev/null || true exit $code } +# --dry-run (-n) creates an empty directory. Remove it to prevent using it for +# further incremental backups (which would do a full backup). +rmdir "$target_tmp" 2>/dev/null && exit 0 || true + mv "$target_tmp" "$target" -- 2.45.2