Trainz Backup - Robocopy

hornbyOO

Occasional User
For anyone interested in backing up Trainz files, I use robocopy which comes as standard in Vista, and is available to XP if you install microsoft server 2003 resource kit (rktools.exe). (Yes it does work in XP even though it says 2003 server)

http://www.microsoft.com/downloads/...69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

It is similar to XCopy but IMO is more robust, i.e. if it comes across a locked file/missing file will retry and then continue, unlike XCopy which will stop processing.

the command is from a command prompt

robocopy <source directory> <destination directory> <arguments>

in my case I use (command all in one go, no carrrriage return) (quotation marks around the destination because of the space in Trainz Backup)

robocopy C:\Program Files\Auran\trs2006\local "Z:\Trainz Backup\TRS2006\local" /S /XO /XX /NS /NDL /NP /TEE /R:5 /W:10 /LOG+:c:\trainzbackup.txt

Arguments as follows

/S include subdirectories
/XO exclude older files
/XX exclude extra files in Destination directory
/NS don't display/log file size
/NDL don't display/log directory names
/NP don't display/log %copied
/TEE display output to screen as well as logging
/R: Retry problem files 5 times
/W:10 wait 10 seconds before retrying
/LOG+: append to logfile (/LOG: overwrites log file)

to see full list of arguments (and there are many) type

robocopy /?

You can use it as a batch file by typing into notepad and saving with a .bat suffix rather than .txt, (i.e trainzbackup.bat) it can then be scheduled or just run from a command prompt/run command.

Vista (Run as an administrator)


The output produced look something like the following

-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Thu Aug 28 09:04:32 2008
Source : c:\Program Files\Auran\trs2006\local\
Dest : Z:\Trainz Backup\TRS2006\local\
Files : *.*

Options : *.* /NS /NDL /TEE /S /COPY:DAT /NP /XX /XO /R:5 /W:10
------------------------------------------------------------------------------
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\bell alpha.bmp
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\bell.tga
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\bell-bell alpha.texture.txt
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\bits.texture.txt
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\bits.tga
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\config.chump
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\house.texture.txt
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\house.tga
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\mesh.im
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\roof.texture.txt
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\roof.tga
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\night\bits.bmp
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\night\bits.tga
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\night\bits-bits.texture.txt
New File c:\Program Files\Auran\trs2006\local\content 0r0xit84419\night\night.im
Newer c:\Program Files\Auran\trs2006\local\content tdp3fqxh5\config.chump
Newer c:\Program Files\Auran\trs2006\local\content tdp3fqxh5\mapfile.bmk
Newer c:\Program Files\Auran\trs2006\local\content tdp3fqxh5\mapfile.Gnd
Newer c:\Program Files\Auran\trs2006\local\content tdp3fqxh5\mapfile.obs
Newer c:\Program Files\Auran\trs2006\local\content tdp3fqxh5\mapfile.trk

------------------------------------------------------------------------------
. Total Copied Skipped Mismatch FAILED Extras
Dirs : 6762 2 6749 0 0 6
Files : 73937 20 73831 0 0 1
Bytes : 4.126 g 8.46 m 4.117 g 0 0 508
Times : 0:02:42 0:00:00 0:00:00 0:02:42
Speed : 24734724 Bytes/sec.
Speed : 1415.332 MegaBytes/min.
Ended : Thu Aug 28 09:07:15 2008

(The summary is properly spaced and lined up- the Trainz Forum removes excess spaces)

Hope you find it useful
 
Last edited:
If your machine is on all the time, you can setup a command prompt-based schedule using the AT command. Here's an example of the AT command.

Code:
C:\Windows\system32>at
Status ID   Day                     Time          Command Line
-------------------------------------------------------------------------------
        1   Each M W F              5:30 PM       "c:\program files\norton pc checkup\pc_checkup.exe" -startscan

Here are the options.

Code:
C:\Windows\system32>at /?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"
[URL="file://\\computername"]\\computername[/URL]     Specifies a remote computer. Commands are scheduled on the
                   local computer if this parameter is omitted.
id                 Is an identification number assigned to a scheduled
                   command.
/delete            Cancels a scheduled command. If id is omitted, all the
                   scheduled commands on the computer are canceled.
/yes               Used with cancel all jobs command when no further
                   confirmation is desired.
time               Specifies the time when command is to run.
/interactive       Allows the job to interact with the desktop of the user
                   who is logged on at the time the job runs.
/every:date[,...]  Runs the command on each specified day(s) of the week or
                   month. If date is omitted, the current day of the month
                   is assumed.
/next:date[,...]   Runs the specified command on the next occurrence of the
                   day (for example, next Thursday).  If date is omitted, the
                   current day of the month is assumed.
"command"          Is the Windows NT command, or batch program to be run.

I use this command to start and stop the SQL server prior to backup on my SQL server. It's really easy to use once you get used to it.

I like the robocopy command instead of the Xcopy as well.

John
 
Back
Top