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