summaryrefslogtreecommitdiff
path: root/Mkfiles/vc15/out_copy_rename.bat
blob: 3179b59aad50b3808190da537bc175fd42490331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@echo off
if not exist %1 goto nofile
if exist %2 goto copy

echo creating directory %2
md %2 > nul

:copy
set str=%2
for /f "useback tokens=*" %%a in ('%str%') do set str=%%~a
set str=%str:~-1%
if %str% == "\" goto hasbackslash

if not exist %2\%3 goto cpy
fc %1 %2\%3 > nul && if not %errorlevel 1 goto exit
echo overwriting %2\%3 with %1
copy %1 %2\%3 > nul
goto exit

:cpy
echo copying %1 to %2\%3
copy %1 %2\%3 > nul
goto exit

:hasbackslash
if not exist %2%3 goto cpy2 
fc %1 %2%3 > nul && if not %errorlevel 1 goto exit
echo overwriting %2%3 with %1
copy %1 %2%3 > nul
goto exit

:cpy2
echo copying %1 to %2%3
copy %1 %2%3 > nul
goto exit

:nofile
echo %1 not found

:exit