summaryrefslogtreecommitdiff
path: root/rsync_tmbackup.sh
diff options
context:
space:
mode:
authorjoekerna <joekerna@users.noreply.github.com>2017-04-19 10:01:30 +0200
committerGitHub <noreply@github.com>2017-04-19 10:01:30 +0200
commitdff1ea00e14526346caf030c4e6ba270d3cbe8ee (patch)
tree90d3dcf631eae1befe8d2193205e543ada87bd42 /rsync_tmbackup.sh
parent78d7121586fa5cc30c4d7de211d2588503d3b177 (diff)
rsync doesn't work with files
Use rsync only to delete directories and stick to rm for files.
Diffstat (limited to 'rsync_tmbackup.sh')
-rwxr-xr-xrsync_tmbackup.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh
index b1d987a..f5a2d01 100755
--- a/rsync_tmbackup.sh
+++ b/rsync_tmbackup.sh
@@ -101,7 +101,13 @@ fn_mkdir() {
fn_rm() {
fn_run_cmd "mkdir /tmp/rsync-time-backup-emptydir"
- fn_run_cmd "rsync -a --delete /tmp/rsync-time-backup-emptydir/ '$1'"
+ if [ -d '$1' ] ; then
+ # when deleting a directory use rsyny for performance reasons
+ fn_run_cmd "rsync -a --delete /tmp/rsync-time-backup-emptydir/ '$1'"
+ elif [ -f '$1' ]; then
+ # when deleting a file use regular rm
+ fn_run_cmd "rm -f '$1'"
+ fi
fn_run_cmd "rm -rf /tmp/rsync-time-backup-emptydir '$1'"
}