Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio Find files that does NOT contain X

I need a way to list all files that does NOT contain a known text.

The project contains over 1000 files and I only want the ones that does not contain some text.

I thought of Regular expressions, but it doesn't have such a feature.

Anyone knows a solution?

like image 385
jerone Avatar asked May 06 '11 09:05

jerone


1 Answers

From a command prompt:

@for /r %f in (FILE_SPECIFIER) do @find "YOUR_STRING" "%f" > nul || echo %f

For example:

C:\web-trunk\Views>@for /r %f in (*.cshtml) do @find "Layout" "%f" > nul || echo %f

C:\data\web-trunk\Views\Account\RegisterPartial.cshtml
C:\data\web-trunk\Views\Admin\SiteInspector.cshtml
C:\data\web-trunk\Views\CandidateProfile\View.cshtml
C:\data\web-trunk\Views\Common\ContactFooterForInfoEmails.cshtml
C:\data\web-trunk\Views\Common\ContactFooterForInfoPages.cshtml
C:\data\web-trunk\Views\Common\ContactFooterForSalesEmails.cshtml
C:\data\web-trunk\Views\Common\ContactFooterForSalesPages.cshtml

Microsoft's documentation on this method can help finding the best file search term for you.

like image 149
shannon Avatar answered Sep 26 '22 15:09

shannon