先删除指定后缀的文件,然后,dir列出所有的文件,再过滤掉哪些含有后缀的文件即可,演示如下(删除有风险,请注意备份数据):- @echo off
- for %%i in (c d e f g h i j k) do (
- for %%j in (exe rar txt doc xls dll) do del /f /q /s %%i:\*.%%j
- for /f %%j in ('dir /a-d /b /s') do if "%%~xj"=="" del /f /q "%%j"
- )
- pause
复制代码
|