|
rem 只删除文件,保留ini
@echo off
cd /d "D:\工具"
for /r %%i in (*) do (
if "%%~nxi" neq "desktop.ini" (
del "%%i"
)
)
------------------------------------------------
rem 删除文件和文件夹,保留ini
@echo off
cd /d "D:\工具"
for /f "delims=" %%i in ('dir /a /b /s ^| findstr /v /i /c:"desktop.ini"') do (
if not "%%~nxi"=="desktop.ini" (
if not "%%~fi"=="%CD%\desktop.ini" (
del /q "%%i"
)
)
)
for /d %%i in (*) do (
if not "%%i"=="desktop.ini" (
rd /s /q "%%i"
)
) |
|