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
Post a Comment