Skip to content

Instantly share code, notes, and snippets.

@dpawluk
Created February 24, 2023 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpawluk/0e9b64806dfd369e28dc82e5ae791dce to your computer and use it in GitHub Desktop.
Save dpawluk/0e9b64806dfd369e28dc82e5ae791dce to your computer and use it in GitHub Desktop.
A possibly unworking attempt at writing a bash script to automatically delete your steam deck Vampire Survivor save files after backing them up (this works) and a shitty restore function (untested).
#! /usr/bin/bash
# the directory of the script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# the temp directory used, within $DIR
# omit the -p parameter to create a temporal directory in the default location
WORK_DIR=`mktemp -d -p "$DIR"`
# check if tmp dir was created
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
echo "Could not create temp dir"
exit 1
fi
# deletes the temp directory
function cleanup {
rm -rf "$WORK_DIR"
echo "Deleted temp working directory $WORK_DIR"
}
# register the cleanup function to be called on the EXIT signal
trap cleanup EXIT
function backupgame {
echo "Backing up your game files to the Desktop as VSBackup.zip"
# copy renderer folder
cp -r ~/.steam/root/steamapps/common/Vampire\ Survivors/resources/app/.webpack/renderer $WORK_DIR/renderer
# copy SaveData folder
cp ~/.steam/steam/userdata/*/1794680/remote/SaveData $WORK_DIR/SaveData
#create zip of backup data
cd $WORK_DIR && zip -r ~/Desktop/VSBackup.zip ./*
if [[ ! "~/Desktop/VSBackup.zip" ]]; then
echo "cannot find zip backup, aborting.."
exit 1
fi
read -p "Successfully backed up game files, do you wish to delete them and reset your VS progress? (Y/N)" deletechoice
if [[ $deletechoice == "Y" ]]
then
echo "deleting current VS save data"
rm -rf ~/.steam/root/steamapps/common/Vampire\ Survivors/resources/app/.webpack/renderer
rm ~/.steam/steam/userdata/$udataid/1794680/remote/SaveData
fi
exit
}
function restoregame {
cd "$WORK_DIR"
read -p "Please enter the path to your backup zip file. " zippath
unzip "$zippath"
cp -r $WORK_DIR/renderer ~/.steam/root/steamapps/common/Vampire\ Survivors/resources/app/.webpack/renderer
cp $WORK_DIR/SaveData ~/.steam/steam/userdata/$udataid/1794680/remote/SaveData
}
read -p "Please enter your userdata id # found in ~/.steam.steam/userdata/{this value}" udataid
if [[ ! "$udataid" ]]
then
echo "you didn't enter any data for the user id"
exit 1
fi
echo "Welcome, do you want to backup or restore your game (B/R)"
read -p "Please choose: " brchoice
if [[ $brchoice == "B" ]]
then
backupgame
fi
if [[ $brchoice == "R" ]]
then
restoregame
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment