rsync doesn't work with files

Use rsync only to delete directories and stick to rm for files.
This commit is contained in:
joekerna 2017-04-19 10:01:30 +02:00 committed by GitHub
parent 78d7121586
commit dff1ea00e1

View file

@ -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'"
}