By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!setlocal
rem returns 1 if files are identical, 0 otherwise
function IsDuplicate=`%@if[%@crc32[%1]==%@crc32[%2],1,0]`
rem returns a relative path
function relpath=`%@right[-%@len[%1],%2]`
rem convert relative input paths to full paths
set f1=%@full[%1]
set f2=%@full[%2]
rem iterate over all the files from the source tree
do f in /a:-d /d"%f1" /s *
rem files are names only in a DO loop. Convert to full path
set sf=%_cwd\%f
rem convert the full path into a relative path and prepend the dest
set df=%[f2]%@relpath[%f1,%sf]
rem test for duplicate
iff exist "%df" .and. %@IsDuplicate["%sf","%df"]==1 then
echo %f is duplicated in %df
endiff
enddo
global /i /q /h for %fn in (*) if %@exec[gosub samefile%fn %1 %2] == 1 echo %1\%fn is duplicated in %2
QUIT
:samefile [fn root1 root2]
set name1=%root1\%fn
set name2=%root2\%fn
iff %@filedate[%name1] eq %@filedate[%name2] .and. %@filetime[%name1] eq %@filetime[%name2] .and. %@filesize[%name1,b] eq %@filesize[%name2,b] .and.%@crc32[%name1] eq %@crc32[%name2] then
return 1
endiff
return 0