From dc5f6bd932faf4ccd8a98955f650550f95b9f35c Mon Sep 17 00:00:00 2001 From: 3err0 Date: Mon, 13 Nov 2023 19:40:10 +0800 Subject: [PATCH] delete files --- rsync_backup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rsync_backup.sh b/rsync_backup.sh index 015eb3b..fc4a92e 100644 --- a/rsync_backup.sh +++ b/rsync_backup.sh @@ -27,6 +27,9 @@ fi if [ "$mode" == "files" ]; then rsync -a --exclude-from=$exclude_file --password-file=$password_file $source $user@$ip::$destination + if [ $? -eq 0 ] && [ "$delete_archive" = true ]; then + rm -rf $source/* + fi else mkdir -p $archive_dir