Project Zomboid character backup automation

Overview

Ever wanted to backup your character so you don't loose it? That's possible by backing up your game after you finish playing it. This page helps you automate it.

After exiting the game, run the script to create a 7z backup file of you character.

Requirements

Configuration

Usually your saves will be in C:\Users\MY_USER_IN_WINDOWS\Zomboid\Saves

Create a powershell script 'lumb2backup.ps1' with below content. This script will 7zip your save file.

Remember to change the following parts with your particular case

Have below code as your backup-script.ps1

  
# Project Zomboid user saves
$folderPath = "C:\Users\MY_USER_IN_WINDOWS\Zomboid\Saves\Sandbox\"

# Name of the save to backup
$folderName = "MY_SAVE_FILE_IN_PZ"

# Target backup path
$backupPath = $folderPath + $folderName

# Define the 7z file path
$7zFilePath = $backupPath + ".7z"

# Check if the 7z file already exists
if (Test-Path $7zFilePath) {
Write-Output "Deleting previous 7z file: $7zFilePath"
Remove-Item $7zFilePath
}

# Compress the folder and its contents into a 7z file
Write-Output "Creating 7z file from folder: $backupPath"
& "C:\Program Files\7-Zip\7z.exe" a -t7z $7zFilePath $backupPath\* -r

# Waits for user confirmation
Read-Host -Prompt "Press Enter to exit"
  

How to use

After finish playing, run the script. It will create a .7z file having your character last play.

If you die, delete the existing content in your save folder and replace with the .7z content