Léna Piquet

[Code] Batch File to Backup Your UDK Data

June 25, 2012

Here is a little batch file that I use to make a copy of my current work with the UDK. Nothing special but i’m sure that some people would find this usefull. This script copy your data in two different place (driveone and drivetwo variable) by making a new folder with the current date and time on the system. I have myself two versions of this batch, one for saving only the source code and the second one for saving everything. The following is the global backup.

Batch File

This script is only for showing the main code, don’t copy/paste it as-is. For example : unless you have changed the code of the BlockingVolume class, you don’t need to save it.

echo Starting backup EXIL from Desktop...
set backupcmd=xcopy /s /c /d /h /i /r /y
set heure=%time:~0,2%
if "%heure:~0,1%"==" " set heure=0%time:~1,1%
set foldertime=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%--%heure%h%Time:~3,2%
set udkfolder=C:\UDK\UDK-2012-01
set driveone=D:\EXIL_backup
set drivetwo=D:\DROPBOX\Dropbox\EXIL\SourceCode

echo ### Backing up UDK source code
%backupcmd% "%udkfolder%\Development\Src\EXIL"          "%driveone%\EXIL_%foldertime%\Development\Src\EXIL\"

echo ### Backing up UDK content
%backupcmd% "%udkfolder%\UDKGame\Content\Maps\*.exm"    "%driveone%\EXIL_%foldertime%\UDKGame\Content\Maps\"
%backupcmd% "%udkfolder%\UDKGame\Content\EXIL"          "%driveone%\EXIL_%foldertime%\UDKGame\Content\EXIL\"
%backupcmd% "%udkfolder%\UDKGame\Script\EXIL.u"         "%driveone%\EXIL_%foldertime%\UDKGame\Script\"
%backupcmd% "%udkfolder%\UDKGame\Splash\PC\*.bmp"       "%driveone%\EXIL_%foldertime%\UDKGame\Splash\PC\"

echo ### Backing up UDK config
%backupcmd% "%udkfolder%\UDKGame\Config\DefaultEditorUserSettings.ini"      "%driveone%\EXIL_%foldertime%\UDKGame\Config\"
%backupcmd% "%udkfolder%\UDKGame\Config\DefaultEngineUDK.ini"       "%driveone%\EXIL_%foldertime%\UDKGame\Config\"
%backupcmd% "%udkfolder%\UDKGame\Config\DefaultEngine.ini"      "%driveone%\EXIL_%foldertime%\UDKGame\Config\"
%backupcmd% "%udkfolder%\UDKGame\Config\DefaultGame.ini"        "%driveone%\EXIL_%foldertime%\UDKGame\Config\"
%backupcmd% "%udkfolder%\UDKGame\Config\DefaultInput.ini"       "%driveone%\EXIL_%foldertime%\UDKGame\Config\"
%backupcmd% "%udkfolder%\UDKGame\Config\DefaultCompat.ini"      "%driveone%\EXIL_%foldertime%\UDKGame\Config\"

%backupcmd% "%udkfolder%\Development\Src\Engine\Classes\BlockingVolume.uc" "%driveone%\EXIL_%foldertime%\Development\Src\Engine\Classes\"
%backupcmd% "%udkfolder%\Engine\Content\EngineMaterials.upk"    "%driveone%\EXIL_%foldertime%\Engine\Content\Classes\"

Simple but easy and efficient. As you can see one of my backup folder is directly inside my Dropbox, which means each backup is saved across my computers. 🙂

Batch to Exe

I use a little program called "Bat_To_Exe_Converter" (you can found it here : Download page) to convert my batch file into an executable application. That’s allow me to pick my backup exe in my taskbar on Windows. No need then to go inside the folder were I saved the batch files. In one click I can launch the bakcup.

The only problem is that you need to recreate this exe every time you change your bat file.