一个目录下只能有一个文件存在?- @echo off
- set "re=[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]"
- for /f "delims=" %%a in ('dir /a-d /b /s^|findstr \\%re%\\') do (
- set "a=%%a"
- setlocal enabledelayedexpansion
- set "b=!a:%~dp0=!"
- set "b=!b:\%%~nxa=!"
- ren "!a!" "!b:\=-!%%~xa"
- endlocal
- )
复制代码
|