How to Create a Quick Backup of Your Files

Article written by Jan dc
Published on 07-04-2016; updated on 01-04-2017
Tags: ,

For modders and scenario designers creating backups is a must. Often you’ll have done something which causes your game or scenario to crash so it’s nice if you can go back to a working version, preferably as recent as possible. Well it’s possible to automate this by using a windows batch file and I’ll quickly show you how it’s done.

Create the batch

Well first of all create a new file and rename it to for example “backup.bat”. It doesn’t matter where you place it or how you call it, as long as it ends with “.bat”. Then open it in a text editor and copy paste the following:

@echo off

:: variables
set drive=C:\Backup
set source=C:\Program Files (x86)\Microsoft Games\Age of Empires II\Games\My Mod
set folder="%d ate:~3,2%-%d ate:~6,3%%time:~0,2%-%time:~3,2%"
set backupcmd=xcopy /s /c /d /e /h /i /r /y

:: actions
echo ### Backing up data files...
%b ackupcmd% "%source%\Data\*.dat" "%drive%\%folder%\Data"
%b ackupcmd% "%source%\Data\language_x1_p1.dll" "%drive%\%folder%\Data"
%b ackupcmd% "%source%\Data\*.drs" "%drive%\%folder%\Data"
%b ackupcmd% "%source%\Scenario\*.scx" "%drive%\%folder%\Scenario"

echo Backup Finished!
@pause

So now replace the set drive to the location you want to keep the backups and the set source to the location where you keep your data files. Remove the spaces from %d ate and %b ackup. I had to add those because the website recognizes percentage ba and da as other characters (anyone know how to fix this by any chance?).

After that you can change the set folder as well. What it does is create a folder of the date, with in it a folder of the hour and minutes. Here it will store your scenario or data files and helps you create different backup files for each change you make. If you don’t mind your backup files to be overwritten you can remove either time or date.

Finally you tell it to copy your files. Here you can add and remove whatever you want backed up. Try it out and see if it works.

You can also time this if you want. For windows vista and later:

  1. Click Start
  2. Click All Programs
  3. Click Accessories > System Tools > Task Scheduler

And tell your computer to schedule to run your batch file when you want it to.

At the end you might also consider automating clean up. But for now this will do.

Good luck!


Do you want to comment on this article? Thank the author? Tribute resources for its improvement? Raze it to the ground?

Come by and visit its thread in the University Forum!