本帖最后由 zaqmlp 于 2017-12-26 20:06 编辑
- @echo off
- rem 测试前先备份原文件夹
- rem 跟以Z或Q开头的文件夹放一起运行
- for /f "delims=" %%a in ('dir /ad/b^|findstr /i "^[qz]"') do (
- if exist ".\%%a\6.取证材料\户口本\" (
- for /f "delims=" %%b in ('dir /ad/b ".\%%a\6.取证材料\户口本\"') do (
- for /f "delims=" %%c in ('dir /a-d/b/s ".\%%a\6.取证材料\户口本\%%b\*.jpg"') do call :mv "%%c"
- echo;
- )
- )
- )
- pause&exit
- :mv
- set "fd=%~dp1"
- for /f "delims=" %%i in ("%fd:~,-1%") do set "fd=%%~dpi"
- set "pic=%fd%\%~nx1"
- set n=1
- setlocal enabledelayedexpansion
- :loop
- if exist "%pic%" (
- set /a n+=1
- set "pic=%fd%\%~n1(!n!)%~x1"
- goto loop
- ) else (
- echo;"%~1" --^> "%pic%"
- move "%~1" "%pic%"
- )
- goto :eof
复制代码
|