俺认为楼主的目的是文件去重,故用MD5而非CRC,代码如下:- @echo off
- rem 保存为ANSI格式
- setlocal
- set "Source_Dir1=D:\01"
- set "Source_Dir2=D:\02"
- set "Target_Dir=D:\03"
- for /f "delims==" %%a in ('set DupFile_ 2^>nul') do set "%%a="
- for /f "usebackq delims=" %%a in (`dir "%Source_Dir1%" "%Source_Dir2%" /a-d /s /b`) do (
- for /f "usebackq tokens=*" %%z in (`certutil -hashfile "%%~fa" MD5^|find /v ":"`) do (
- if defined DupFile_%%z (
- move /y "%%~a" "%Target_Dir%"
- ) else (
- set "DupFile_%%z=True"
- )
- )
- )
- endlocal
复制代码
|