- @Echo Off&Color 0e
-
- ((if exist "%~f1\" (cd/d "%~f1")else cd/d "%~dp1")||cd/d "%~dp0") 2>nul
- echo,执行目录包含子目录:%cd%
- pause
- call:1 ".jpg"
- echo,任意键退出
- pause&exit
- :1
- for /f "delims=" %%i in ('dir/a-d/s/b ".\*%~x1"')do if exist "%%~fi" (
- if not defined %%~dpi (
- set "%%~dpi=y"
- set "delete="
- set "_="
- for /f "delims=" %%j in ('dir/a-d/b "%%~dpi\*%%~xi" 2^>nul')do if /i not "%%~fi"=="%~f0" (
- if not defined delete (
- echo,已过虑:"%%~dpi%%~nxj"
- set/a "_+=1"
- for /f "delims=" %%n in ('call echo,%%_%%')do if %%n geq 3 set "delete=y"
- )else (
- echo,删除中:"%%~dpi%%~nxj"
- del/q "%%~dpi%%~nxj"||(echo,删除失败暂停等待&&pause)
- )
- )
- )
- )
- goto:eof
复制代码
|