diff --git a/btrbk b/btrbk index 8b16cee..48a021f 100755 --- a/btrbk +++ b/btrbk @@ -107,8 +107,8 @@ function runFullRestore { echo "Wrong Passphrase" done;; esac - local bkSuffix=("${INCR[0]}" "${FULL[0]}") - btrfs subvolume create $restoreDir"restore" + local bkSuffix=("${FULL[0]}" "${INCR[0]}") + btrfs subvolume create $restoreDir"restore" 2>/dev/null lastBkDate=$(rclone lsf "$rcloneDir" | grep ....-..-${FULL[0]} | tail -n -1 | sed "s/full\/$//") for i in ${!bkSuffix[@]}; do mapfile -t bkFile < <(rclone lsf "$rcloneDir$lastBkDate${bkSuffix[$i]}" 2>/dev/null) @@ -120,6 +120,11 @@ function runFullRestore { newestSnap=$(ls -a $restoreDir"restore" | grep ${VOLNAME[$i]}.\....-..- | tail -n -1 ) btrfs subvolume snapshot $restoreDir"restore/"$newestSnap $restoreDir${VOLNAME[$i]} done + mapfile -t delVol < <(ls $restoreDir"restore") + for i in ${!delVol[@]}; do + btrfs subvolume delete $restoreDir"restore/"${delVol[$i]} + done + btrfs subvolume delete $restoreDir"restore" end }