本来这种批处理到处可见没什么稀奇,关键在于我的批处理支持畸形文件夹,谢谢
搜索完成后完整路径保存在当前目录list.txt文件中
本来想制作删除的。。。如果要做成删除的话在后面加上for /f %%i in (list.txt) do (del %%i /f /a /q)
本作品是改编的。。原作者只做了搜索2层目录,我只不过稍加修改。。现在是全盘所有目录- SET TestFile=Test_%RANDOM%.TMP
- SETLOCAL ENABLEDELAYEDEXPANSION
- For %%I In (A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) Do (
- CD.>%%I\%TestFile%
- cls&&If Exist %%I\%TestFile% echo %%I >>pflist.txt&&DEL %%I\%TestFile% /Q
- )
- for /f %%i in (pflist.txt) do (
- for /f "delims=$$$" %%I in ('dir /b /a-d /o-d "%%i\*.gho" 2^>nul') do (echo %%i\%%I >>list.txt
- )
- )
- :a
- copy pflist.txt google.txt /y
- set /p=<nul>pflist.txt
- for /f %%o in (google.txt) do (
- for /f "tokens=*" %%i in ('dir /b /x /ad "%%o\"') DO (
- for /f "delims=$$$" %%a in ('dir /b /a-d /o-d "%%o\%%i\*.gho" 2^>nul') do (
- echo %%o\%%i\%%a >>list.txt
- )
- echo %%o\%%i >>pflist.txt
- )
- )
- for %%i in (pflist.txt) do if "%%~zi"=="0" (del pflist.txt&&del google.txt&&exit) else (goto a)
复制代码
|