7 Days to Die – Auto Backup of Game

Automatically backup your save game daily and remove old saves after they’re 7 days old.

Other 7DTD Guides:

7 Days to Backup Full Guide

First off I’ve made this guide as there are multiple bug reports that people have lost their entire progress or entire base etc, This is the best thing to combat that within the beta stage as you can always revert to a previous day before everything went wrong.

Script

  • First off right click somewhere (I made this on the desktop) select New>Text Document.
  • This will make a new text document on your desktop, double click it and your text editor will open most likely Notepad.
  • Copy and paste then edit the code below noting that you replace %username% with your username on your computer, this is handy if the scheduled task is running as a different user than the game saves are located in, you can probably leave it as %username% if you only have one user on your computer.

Also if you have a different backup path or only have one drive make sure to change it from D: to something else.

xcopy "C:\Users\%username%\AppData\Roaming\7DaysToDie" "D:\7DaystoDieBackup\%date%\"  /s /e /c
forfiles -p "D:\7DaystoDieBackup" -d -7 -c "cmd /c IF @isdir == TRUE rd /S /Q @path"

Once you have it how you want it select File>Save As and select All Files instead of .txt and call it 7DaysToBackup.bat this will change the file type to a batch script.

For more info on what each line does, xcopy copies from “source” to “destination” and %date% adds folders for the current date so you know what day each of the backups are from.

For files checks how old the folder is as its got the @isdir == TRUE so it won’t delete subfiles/folders it will only delete from within your backup directory, the -d -7 is how old the backup must be before it is deleted, you can change this to whatever value you want just make sure that you have enough space to support the amount of copies you require.

Schedule a Task

  • Push your windows key or click start and search for “Task Scheduler”.
  • Up the top right there will be “Create Basic Task” click it.
  • The “Create Basic Task Wizard” will pop open.
  • Give your task a reasonable name such as 7DaysToBackup.
  • Click Next.
  • Daily.
  • Click Next.
  • Set a different time if you desire, if your running the game on a sever anytime is fine, if you’re running it on your own computer make sure its a time that your computer will be powered on.
  • Click Next.
  • Start a Program.
  • Click Next.
  • Browse for the 7DaysToBackup.bat file you created earlier.
  • Click Next.
  • Click Finish.

And you’re done, you will now automatically backup your save game every day and when a save is older than 7 days it will be deleted.

Recommended for You

3 Comments

  1. I got so many errors trying to run your code that I completely rewrote it.
    ———————————————
    @echo off
    set CUR_YYYY=%date:~10,4%
    set CUR_MM=%date:~4,2%
    set CUR_DD=%date:~7,2%
    set CUR_HH=%time:~0,2%
    if %CUR_HH% lss 10 (set CUR_HH=0%time:~1,1%)

    set CUR_NN=%time:~3,2%
    set CUR_SS=%time:~6,2%
    set CUR_MS=%time:~9,2%

    set SUBFILENAME=%CUR_YYYY%%CUR_MM%%CUR_DD%-%CUR_HH%%CUR_NN%%CUR_SS%
    set OriginalSave=”%AppData%\7DaysToDie\Saves\Vunazu Territory\”
    set ProfilePath=c:\users\%username%\7D2D.Backup

    IF /I NOT EXIST %ProfilePath% (
    MKDIR %ProfilePath% >NUL 2>&1
    )

    mkdir %ProfilePath%\%SUBFILENAME%

    :Change the below to your save game MapName
    :Dont put “Roaming” after “%AppData%”
    xcopy /h /e %OriginalSave% “%ProfilePath%\%SUBFILENAME%\Vunazu Territory\”

    pause
    —————————————–

  2. This works, however xcopy is a heavy transfer over and will chew up a hard drive and push your cpu usage way up. SSD may handle it better but likely still hurts a busy server. You can reduce the load slightly but it still kills the data transfer making most servers bottleneck during the save. ServerTools has a backup option as one of the tools offered. It also compresses the data for you reducing the backup of large worlds

  3. If you prefer the robo method, here are some helpful things you can do with the code for compression and clean up while checking it is running. I put it on as an auto task within windows. Very simple .bat file but powerful what it was doing. Really bottle necked our servers tho. I dont know of any cpu or thread handling with that operation but if you can find a way, that would improve the lag for you. It would take much longer to achieve tho

Leave a Reply

Your email address will not be published.


*