Bat查找某种类型的文件 Posted on 2018-07-04 查找某种类型的文件123456789101112131415161718192021222324252627282930@echo offset pwd=%cd%set type=tmp:: cd %TEMP%cd %USERPROFILE%\AppData\Local\Temp:: https://my.oschina.net/solee/blog/75763:: 统计特定文件夹下的文件个数的DOS命令:dir /s /b | find /c ":",或者:dir /s /b | find /v /c "":: dir /b *.tmp^ | find /v /n "":: dir /b *.tmp^ | find /v /c "":: dir /b ^ | findstr /n .*.tmp:: https://zhidao.baidu.com/question/344424350.htmlfor /f "delims=:" %%i in ('dir /b *.%type%^|findstr /n .') do set count=%%i:: https://www.zhihu.com/question/51968876:: for /f "tokens=1* delims=:" %%i in ('dir /a-d /b *.%type%^|findstr /n /r "$"') do @set count=%%iecho total have %count% %type% filesfor /f %%i in ('dir /b *.tmp^|find /v /c ""') do set new_count=%%iecho total have %new_count% %type% filesdel /s /q *.tmpcd %pwd%pause