Skip to content

Instantly share code, notes, and snippets.

@fewtarius
Created February 1, 2026 19:00
Show Gist options
  • Select an option

  • Save fewtarius/4a124ad84314c3621e891c218fa82eaf to your computer and use it in GitHub Desktop.

Select an option

Save fewtarius/4a124ad84314c3621e891c218fa82eaf to your computer and use it in GitHub Desktop.
#!/bin/bash
# Restore script for Heroic game saves (SteamOS/SteamFork)
# Restores a selected game's save from backup to its original location
# Usage: ./restore_heroic_save.sh <GameName> <BackupFile>
SRC_DIR="/var/run/media/primary/Backups"
DEST_DIR="$HOME/Games/Heroic/Prefixes/default"
if [ "$#" -ne 2 ]; then
echo "Usage: $ <GameName> <BackupFile>"
echo "Example: $ 'theHunter Call of the Wild' theHunter\ Call\ of\ the\ Wild-backup-20260201_125759.tar.gz"
exit 1
fi
GAME_NAME="$1"
BACKUP_FILE="$2"
GAME_DEST="$DEST_DIR/$GAME_NAME"
BACKUP_PATH="$SRC_DIR/$BACKUP_FILE"
if [ ! -d "$GAME_DEST" ]; then
echo "Game directory $GAME_DEST does not exist."
exit 2
fi
if [ ! -f "$BACKUP_PATH" ]; then
echo "Backup file $BACKUP_PATH does not exist."
exit 3
fi
# Extract backup to game directory
# (removes old contents, then restores)
rm -rf "$GAME_DEST"/*
tar -xzf "$BACKUP_PATH" -C "$GAME_DEST"
echo "Restore complete for $GAME_NAME from $BACKUP_FILE."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment