Tuesday 29 July 2008

Thou Shalt Backup Thy Module!

Thought I would share this simple bat-script with you fellow module builders. It's great to have it on the desktop so that I can backup my module directory fast and easy. The date format is Swedish but you can easily shuffle around the %yy%, %mm% and %dd% to fit your own needs. Just configure the SourceFolder and DestinationFolder and save. Even though you could use it on the entire modules folder I would recommend to use it with directory mode and you working folder.

@echo off
rem ** Backup script for NWN2 Directory Mod
e Modules **
rem ** The usual disclaimer applies - If you use it, it's your own fault **

rem ** Configuration **
set SourceFolder=C:\Documents and Settings\User\My Documents\Neverwinter Nights 2\modules\My Module
set DestinationFolder=C:\Documents and Settings\
User\My Documents\Neverwinter Nights 2\modules\Backup MyModule
My Module

rem ** **

for /f "tokens=2-4 delims=/ " %%g in ('date /t') do (
set mm=%%g
set dd=%%h
set yy=%%i
)

for /f "tokens=1-2 delims=: " %%j in ('time /t') do (
set hh=%%j
set mn=%%k

)
if exist "%DestinationFolder%\%yy%-%mm%-%dd%-%hh%%mn%" (
rd /S /Q "%DestinationFolder%\%yy%-%mm%-%dd%-%hh%%mn%"
)

xcopy "%SourceFolder%" "%DestinationFolder%\%yy%-%mm%-%dd%-%hh%%mn%" /s /i


3 comments:

Jclef said...

Good call, bud - backups are just a double-click away!

Easily modifiable for multiple modules and a campaign directory as well.

Just wait 'til the Martians hear about this one!

Wyrin said...

hehe is that the mysterious thief in the screenshot?

Submarine Vet - OWNER said...

Hey guys, there is a Zork 1 Map on eBay, looks like it is going cheap (for now)