From eb9625bddcb3f371fe638ba1909fed8f642fe5ca Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Wed, 24 Jun 2015 21:43:00 +0200 Subject: [PATCH] Hotfix #22 added rm -rf if file already exists Fix is only useful if deleted directories already exist and are not empty --- osync.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osync.sh b/osync.sh index ba38999..974817b 100755 --- a/osync.sh +++ b/osync.sh @@ -1179,6 +1179,10 @@ function _delete_local if [ $dryrun -ne 1 ] then + if [ -e "$REPLICA_DIR$3$files" ] + then + rm -rf "$REPLICA_DIR$3$files" + fi mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$3" if [ $? != 0 ] then @@ -1282,6 +1286,10 @@ $SSH_CMD error_alert=0 sync_on_changes=$sync_on_changes silent=$silent DEBUG=$DE if [ $dryrun -ne 1 ] then + if [ -e "$REPLICA_DIR$DELETE_DIR$files" ] + then + $COMMAND_SUDO rm -rf "$REPLICA_DIR$DELETE_DIR$files" + fi $COMMAND_SUDO mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$DELETE_DIR" if [ $? != 0 ] then