2012-11-25 16:25:43 -05:00
|
|
|
@echo off
|
|
|
|
if not exist %1 goto nofile
|
2013-03-26 18:52:46 -04:00
|
|
|
if exist %2 goto next
|
2012-11-25 16:25:43 -05:00
|
|
|
|
|
|
|
echo creating directory %2
|
|
|
|
md %2 > nul
|
|
|
|
|
2013-03-26 18:52:46 -04:00
|
|
|
:next
|
|
|
|
rem strip quotes if present
|
2012-11-25 16:25:43 -05:00
|
|
|
set str=%2
|
|
|
|
for /f "useback tokens=*" %%a in ('%str%') do set str=%%~a
|
2013-03-26 18:52:46 -04:00
|
|
|
|
|
|
|
rem add a backslash if the output directory lacks one
|
2012-11-25 16:25:43 -05:00
|
|
|
set str=%str:~-1%
|
2013-03-26 18:52:46 -04:00
|
|
|
if "%str%" == "\" (set outf=%2%3) else (set outf=%2\%3)
|
2012-11-25 16:25:43 -05:00
|
|
|
|
2013-03-26 18:52:46 -04:00
|
|
|
echo copying %1 to %outf% (if not present or changed)
|
|
|
|
if not exist "%outf%" goto copy
|
2012-11-25 16:25:43 -05:00
|
|
|
|
2013-03-26 18:52:46 -04:00
|
|
|
rem don't overwrite if output exists and is not changed
|
|
|
|
fc %1 %outf% > nul && if not %errorlevel 1 goto exit
|
|
|
|
echo overwriting %outf% with %1
|
2012-11-25 16:25:43 -05:00
|
|
|
|
2013-03-26 18:52:46 -04:00
|
|
|
:copy
|
|
|
|
copy %1 %outf% > nul
|
2012-11-25 16:25:43 -05:00
|
|
|
goto exit
|
|
|
|
|
|
|
|
:nofile
|
|
|
|
echo %1 not found
|
|
|
|
|
|
|
|
:exit
|