- @echo off
- setlocal enabledelayedexpansion
- cd /d "%~dp0"
-
- for /f "delims=" %%a in ('dir /a-d /b *.doc') do (
- for /f "tokens=2 delims=()" %%b in ("%%a") do (
- set group_%%b=!group_%%b!,"%%a"
- set /a "count_%%b+=1"
- )
- )
-
- for /f "tokens=1* delims==" %%a in ('set count_') do (
- if %%b geq 2 (
- for /f "tokens=1* delims=_" %%c in ("%%a") do (
- md "%%d\" 2>nul
- for %%e in (!group_%%d!) do (
- echo move %%e "%%d\"
- move %%e "%%d\"
- )
- )
- )
- )
-
- endlocal
- pause
- exit /b
复制代码
|