From a0985b9335e6b12a6d37f951e9f8c499b22f55b3 Mon Sep 17 00:00:00 2001 From: Dashboy1998 <18587674+Dashboy1998@users.noreply.github.com> Date: Sun, 17 Nov 2024 03:15:37 -0500 Subject: [PATCH] Updated restore.sh to move Palworld backup folder during restore --- scripts/restore.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/restore.sh b/scripts/restore.sh index 186b0b1ce..216f020dd 100644 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -109,6 +109,19 @@ if [ -f "$BACKUP_FILE" ]; then # Decompress the backup file in tmp directory tar -zxvf "$BACKUP_FILE" -C "$TMP_PATH" + # Find backup folders + mapfile -t backup_folders < <(find "$RESTORE_PATH" -name "backup" -type d | sed "s|^$RESTORE_PATH||") + + # Check if backup folder parents exist in restore + for backup_folder in "${backup_folders[@]}" + do + backup_folder_dirname=$( dirname "$backup_folder" ) + if [ -d "$TMP_PATH/$backup_folder_dirname" ]; then + # Move backup folder into restore + mv "$RESTORE_PATH/$backup_folder_dirname/backup" "$TMP_PATH/$backup_folder_dirname" + fi + done + # Make sure Saves with a different ID are removed before restoring the save rm -rf "$RESTORE_PATH/Saved/"