Palworld – Simple User Friendly-ish Dedicated Server Auto Backup (Batch Script)

Server Auto Backup

As I was hosting a server and researched that there’ve been instances where players can get their saves corrupted so I made my own batch script that backs up on an x interval of minutes.

I figured I could share it to everyone:

  • Easy to modify
  • Auto backup that runs forever until closed or a one time backup when launched.
  • Choose the interval time, in the .bat file (default is 30 mins)
  • Choose the location of the backup file (default is inside your save folder)
  • Timestamp on backup file
  • Compresses the file in a zip (using 7zip or winrar)
  • Must have at least 7zip or WinRAR (your choice)

How to install:

  • You need file extension to be on.
  • Create a text file and name it `Auto backup.bat` or `Single Backup.bat` or something else (up to you)
  • Copy these

Auto Backup

@echo off
setlocal enabledelayedexpansion

REM User Configuration
set "saveFolderName=7H3R4ND0M57R1N60F73XT1N51D3Y0UR5AV3D1R"
set "backupFolderName=Backup"
set "backupDir=Pal\Saved\SaveGames\0\%saveFolderName%"
set "intervalMinutes=30"
REM set "winrarPath=C:\Path\To your\Winrar\rar.exe" remove 'REM' to use this

REM Do not edit this section (Unless you know what you're doing)
set "saveDir=.\Pal\Saved\SaveGames\0\%saveFolderName%"
set "actualBackupDir=%saveDir%\%backupFolderName%"
set /a "intervalSeconds=%intervalMinutes%*60"


:backupLoop
echo Waiting for next interval...
REM Wait for the specified interval before the next backup
timeout /t %intervalSeconds% /nobreak >nul


REM Get timestamp for backup folder (date and time without seconds)
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set "datetime=%%I"
set "timestamp=!datetime:~0,4!_!datetime:~4,2!_!datetime:~6,2!-!datetime:~8,2!_!datetime:~10,2!_!datetime:~12,2!"

set "backupName=%backupDir%\%backupFolderName%\Backup_%timestamp%.zip"


REM Create archive using 7zip excluding backupFolderName (in case the backup folder is inside the source)
7z a -r -tzip "!backupName!" "%saveDir%\*" -x^^!"%actualBackupDir%" -mx9

REM Create archive using WinRAR excluding backupFolderName (to use this add REM to 7z line, remove the REM for 'winrarPath' and the REM below and set the path of winrar)
REM "%winrarPath%" a -r -ep1 "!backupName!" "%saveDir%\*" -x^!"%actualBackupDir%" -m5

echo:
echo Backup completed: %backupName%
echo:
echo:

goto backupLoop

Single Backup

@echo off
setlocal enabledelayedexpansion

REM User Configuration
set "saveFolderName=7H3R4ND0M57R1N60F73XT1N51D3Y0UR5AV3D1R"
set "backupFolderName=Backup"
set "backupDir=Pal\Saved\SaveGames\0\%saveFolderName%"
REM set "winrarPath=C:\Path\To your\Winrar\rar.exe" remove 'REM' to use this

REM Do not edit this section (Unless you know what you're doing)
set "saveDir=.\Pal\Saved\SaveGames\0\%saveFolderName%"
set "actualBackupDir=%saveDir%\%backupFolderName%"


REM Get timestamp for backup folder (date and time without seconds)
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set "datetime=%%I"
set "timestamp=!datetime:~0,4!_!datetime:~4,2!_!datetime:~6,2!-!datetime:~8,2!_!datetime:~10,2!_!datetime:~12,2!"

set "backupName=%backupDir%\%backupFolderName%\Backup_%timestamp%.zip"


REM Create archive using 7zip excluding backupFolderName (in case the backup folder is inside the source)
7z a -r -tzip "!backupName!" "%saveDir%\*" -x^^!"%actualBackupDir%" -mx9

REM Create archive using WinRAR excluding backupFolderName (to use this add REM to 7z line, remove the REM for 'winrarPath' and the REM below and set the path of winrar)
REM "%winrarPath%" a -r -ep1 "!backupName!" "%saveDir%\*" -x^!"%actualBackupDir%" -m5

echo:
echo Backup completed: %backupName%
echo:
echo:

pause
Volodymyr Azimoff
About Volodymyr Azimoff 13821 Articles
I love games and I live games. Video games are my passion, my hobby and my job. My experience with games started back in 1994 with the Metal Mutant game on ZX Spectrum computer. And since then, I’ve been playing on anything from consoles, to mobile devices. My first official job in the game industry started back in 2005, and I'm still doing what I love to do.

Be the first to comment

Leave a Reply

Your email address will not be published.


*