使用批处理按要求批量删除文件夹方法汇总

2019-09-19 06:39:41刘景俊
@echo off
echo 正在扫描文件。。。
for /f "delims=" %%a in ('dir /a-d /s /b .picasaoriginals') do (
if /i "%%~nxa"==".picasaoriginals" (
if exist "%%~a" (
echo del /f /q "%%~a">>DelNow.bat
)
)
)
if exist "DelNow.bat" (
ping 0 -n "2">nul
call:qd
)
del /f /q DelNow.bat
exit
 
:qd
cls
set /p q=确认删除吗?(输入Y确定,其它退出):
cls
if /i "%q%"=="Y" (
echo 正在删除中。。。
ping 0 -n "2">nul
call DelNow.bat
cls
echo 删除完成!
ping 0 -n "2">nul
)
goto :eof

示例三:

批量删除电脑中所有带qqq的文件和文件夹

@echo off
echo....文件查找,请等待...
c:
for /r c: %%a in (.) do @if exist %%aqqq.* del %%aqqq.*
for /r c: %%a in (.) do @if exist %%aqqq rd /s /q %%aqqq
d:
for /r d: %%a in (.) do @if exist %%aqqq.* del %%aqqq.*
for /r d: %%a in (.) do @if exist %%aqqq rd /s /q %%aqqq
e:
for /r e: %%a in (.) do @if exist %%aqqq.* del %%aqqq.*
for /r e: %%a in (.) do @if exist %%aqqq rd /s /q %%aqqq
f:
for /r f: %%a in (.) do @if exist %%aqqq.* del %%aqqq.*
for /r f: %%a in (.) do @if exist %%aqqq rd /s /q %%aqqq
goto end
:end
echo good bye!

相关文章 大家在看