这个代码是没风险的,代码也比较稳定- @md "D:\test 1" 2>nul
- @md "D:\test 2" 2>nul
- @md "D:\test.tmp" 2>nul
- @md "D:\test 2\test" 2>nul
- echo.>"D:\test 1\a.jpg"
- echo.>"D:\test 2\b.jpg"
- echo.>"D:\test 2\test\c.jpg"
- echo.>"D:\test.tmp\d.jpg"
- echo.>e.jpg
- @echo 测试文件已准备
- @pause
-
-
- @echo off
- set Soigne=整理过的JPG
- md %Soigne% 2>nul
- for /f "delims=" %%a in ('dir /s/a-d/b D:\*.jpg^|sort/r^|find /v /i "%Soigne%"') do call :xxx "%%a"
- pause
- :xxx
- set "FolderPath=%~dp1"
- for /f "delims=" %%i in ("%FolderPath:~0,-1%.tmp") do set "FormatFolderPath=%%~ni"
- move /y "%~1" "%Soigne%\%FormatFolderPath%%~nx1"
- if not exist "%FolderPath%*.jpg" if not "%FolderPath:~3%"=="" echo 将要删除 rd /q /s "%FolderPath%"
复制代码 代码在下列目录结构下会存在BUG- @md "D:\test" 2>nul
- @md "D:\test\test" 2>nul
- echo.>"D:\test\test\c.jpg"
- echo.>"D:\test\c.jpg"
- @echo 测试文件已准备
- @pause
-
- ......
复制代码
|