compare file content in folder using windows batch -


i've been struggling several days... there 1 folder lot txt files random names generated server timestamps, content of files must not identical 2 files in folder! ideas? option using windows batch

@echo off setlocal set "sourcedir=u:\sourcedir" pushd "%sourcedir%" %%a in (*.*) (  %%c in (*.*) if /i "%%~nxa" lss "%%~nxc" if "%%~za"=="%%~zc" (   fc "%%a" "%%c" >nul   if not errorlevel 1 echo "%%a" , "%%c" identical   ) )  goto :eof 

you need change setting of sourcedir , of filemask *.* suit circumstances.


revision only-one-mention-of-a-duplicate-file

@echo off setlocal set "sourcedir=u:\sourcedir" pushd "%sourcedir%" %%a in (*.*) (  set "reported="  %%c in (*.*) if not defined reported if /i "%%~nxa" lss "%%~nxc" if "%%~za"=="%%~zc" (   fc /b "%%a" "%%c" >nul   if not errorlevel 1 echo "%%a" , "%%c" identical&set reported=y  ) ) 

goto :eof

i've added /b fc allow non-text files.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -