develog

[cmd] backup.bat 본문

OS & Shell/Windows

[cmd] backup.bat

냐옴 2014. 12. 3. 11:55

@echo off

echo -----------------------------------------------------------


set date2=%date%

set time2=%time%

set time2=%time2:~0,2%%time2:~3,2%%time2:~6,2%

set now=%date2% %time2%

set dir=%now%

mkdir "%dir%"


set baseDir=C:\aa\bb\

set dstDir="C:\cc\dd ee\"


echo baseDir = %baseDir%

echo dstDir  = %dstDir%


::--------------------------------------------------------------

call :copyAll %baseDir% %dstDir% %baseDir%\src\xx\sample1.txt

call :copyAll %baseDir% %dstDir% %baseDir%\src\yy\zz\sample2.txt

::--------------------------------------------------------------


echo -----------------------------------------------------------


goto :EOF


:copyAll

setlocal

set _baseDir=%1

set _dstDir=%2

set _srcFile=%3

set _path=%_srcFile:~45%

echo f | xcopy /e %_srcFile% %_dstDir%%_path%

endlocal



'OS & Shell > Windows' 카테고리의 다른 글

[cmd] 함수 선언, 실행  (0) 2014.12.03
[cmd] array loop  (0) 2014.12.03
[cmd] 폴더 copy  (0) 2014.12.03
[cmd] 주석  (0) 2014.12.03
[cmd] 날짜, 시간으로 폴더 생성  (0) 2014.12.03
Comments