最后四个不规则无法区分版本号
- :虚拟引入
- del/q ".\不规则的完整路径.log"
- for /f "delims=" %%i in ('dir/a-d/s/b ".\*.pdf"')do (
- set "notmove=%%~nxi"
- if /i "!notmove!"=="!notmove:_=!" echo/&echo,不规则的文件和路径:%%~nxi ;%%~dpi&&(echo,%%~fi)>>".\不规则的完整路径.log"
- for /f "tokens=1,* delims=_" %%j in ("%%~nxi")do (
- set "_=000000%%~nk"
- set "_=%%j_!_:~-5!%%~xi"
- set "#%%j_!_:~-5!%%~xi=%%~fi"
- )
- )
- set "_="&&set "notmove="
- :最终保留
- for /f "tokens=1,* delims==" %%i in ('set #')do for /f "delims=_" %%i in ("%%j")do set "保留%%i=%%j"
- :虚拟清空
- for /f "tokens=1,* delims==" %%i in ('set #')do set "%%i="
- :目录树结果
- for /f "tokens=1,* delims==" %%i in ('set 保留')do echo,%%j
- echo,任意键实体操作
- pause
- :实体操作
- for /f "delims=" %%i in ('dir/a-d/s/b ".\*.pdf"')do (
- set "error=y"&&for /f "tokens=1,* delims==" %%j in ('set 保留')do if /i "%%~fi"=="%%~fk" set "error="
- if defined error (
- echo, 移动: %%~fi
- )else (
- echo,不移动: %%~fi
- )
- )
- pause
- goto:eof
复制代码
|