@ECHO OFF
REM Backup of Railworks route in progress
REM This will copy files from the source folder to a new destination folder
REM The name of the destination folder is the current date and time
REM Change variables "Source" and "Destination" in the two lines below to suit your project
SET Source=I:\Steam\steamapps\common\railworks\Content\Routes\00000001-0000-0000-0000-000000000000
SET Destination=J:\railworks\MyRoute
REM Change variable "Files" for your file filter if needed
SET Files=*.*
REM We use current date and time for versioning
REM Note that the output of date and time is locale-dependent
REM You will have to adjust the parsing to fit the output of your DATE and TIME commands.
REM To do this, open a command window (Start / Run / cmd)
REM Type DATE. Whatever comes after "The current date is: " is your localized date format.
REM Type TIME. Whatever comes after "The current time is: " is your localized time format.
REM Then adjust the following SET lines to set variables correctly for year, month, etc.
rem Parse the date (e.g., 2013-01-01)
rem Example: the line below takes the first 4 characters of "2013-01-01" and puts them in "cur_year".
set cur_year=%date:~0,4%
set cur_mo=%date:~5,2%
set cur_da=%date:~8,2%
rem Parse the time (e.g., 16:20:08,69)
set cur_hh=%time:~0,2%
if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
set cur_mm=%time:~3,2%
set cur_ss=%time:~6,2%
set cur_ms=%time:~9,2%
rem Set the timestamp format
set timestamp=backup%cur_year%%cur_mo%%cur_da%%cur_hh%h%cur_mm%
rem Example: backup2013010116h37
ECHO %timestamp%
CD %Destination%
MD %timestamp%
CD %timestamp%
XCOPY %Source%\%Files% /S
PAUSE
rem Clear environment variables
set cur_year=
set cur_mo=
set cur_da=
set cur_hh=
set cur_mm=
set cur_ss=
set cur_ms=
set timestamp=
Set Source=
Set Destination=
Set Files=
Return to Problems and Peculiarities
Users browsing this forum: No registered users and 2 guests