@echo off
set backupdir=X:\i8\Stages\BU\
set sourcedir=c:\temp
REM Create the date and time elements.
for /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $d $t"') do (
for /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
set dow=%%i
set %%a=%%j
set %%b=%%k
set %%c=%%l
set hh=00%%m
set hh=%hh:~-2%
set min=%%n
set ss=%%o
set datetime=%yy%%mm%%dd%_%hh%%min%
)
)
echo %datetime%
@echo on
REM Make Backup dir
if not exist %backupdir%%datetime% mkdir %backupdir%%datetime%
REM Copy file to backup including sub dirs
xcopy %sourcedir% %backupdir%%datetime%\ /S /Y
Till Next Time
Wednesday, January 29, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment