Liomblr RSS

Archive

Aug
15th
Sat
permalink

[Windows] Tests if hardlinks are to be cut by move, copy, xcopy, etc.

call :init
echo * link > log.txt
type _src\file.txt _dest\file.txt >> log.txt


call :init
echo * redirect >> log.txt
echo overwritten by redirect > _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * move >> log.txt
echo overwritten by move > _tmp\file.txt
move /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * copy >> log.txt
echo overwritten by copy > _tmp\file.txt
copy /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * xcopy >> log.txt
echo overwritten by xcopy > _tmp\file.txt
xcopy /y _tmp\file.txt _src
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * robocopy >> log.txt
echo overwritten by robocopy > _tmp\file.txt
robocopy _tmp _src file.txt
type _src\file.txt _dest\file.txt >> log.txt


call :init
del _src\file.txt
echo * del - redirect >> log.txt
echo overwritten by redirect > _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - move >> log.txt
echo overwritten by move > _tmp\file.txt
move /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - copy >> log.txt
echo overwritten by copy > _tmp\file.txt
copy /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - xcopy >> log.txt
echo overwritten by xcopy > _tmp\file.txt
xcopy /y _tmp\file.txt _src
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - robocopy >> log.txt
echo overwritten by robocopy > _tmp\file.txt
robocopy _tmp _src file.txt
type _src\file.txt _dest\file.txt >> log.txt


rmdir _src _dest _tmp /q /s
exit /b

:init
rmdir _src _dest _tmp /q /s
mkdir _src _dest _tmp
echo linked > _src\file.txt
mklink /h _dest\file.txt _src\file.txt