如何查找具有特定模式的文件夹和文件 [英] How to find folders and files with specific pattern
本文介绍了如何查找具有特定模式的文件夹和文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想编写一个批处理文件,该文件将写入日志以记录包含特定模式的所有文件和文件夹,并包含排除文件夹,但没有成功:
I want to write a batch file that will write to log all files and folders that contains specific patterns, and with exclude folders, but without success:
@ECHO OFF
for /r "%c:\" %%x in (david) do (
echo "%%x"
findstr /f:exclude.txt /c:"%%x" > nul || echo.%%x >> c:\david.log
)
goto :eof
排除文件:
C:\ $ Recycle.Bin \ c:\ temp \
exclude file:
C:\$Recycle.Bin\ c:\temp\
帮助?
推荐答案
(排除为/g:
; /f:
是非常不同的东西-请参见for /?
)
(exclude is /g:
; /f:
is a very different thing - see for /?
)
for /r %%i in (*david*) do echo %%i|findstr /v /i /g:exclude.txt >>c:\david.log
这篇关于如何查找具有特定模式的文件夹和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文