简体   繁体   中英

Does anyone know of a utility that will find all files that do NOT contain a specified string

There are lots of utilities that will find all text files of a specified type and location that contain a specified string (I'm talking about file content now, not file name), but not one of them seems to be able to search all the specified files for the ones that do NOT contain the given string. Does anyone know of such a utility?

Sure, Windows PowerShell will do it for you:

Get-ChildItem path\to\folder -Filter *.txt |Where-Object { -not($_ |Select-String -SimpleMatch "given string" |Select -First 1) }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM