Notepad++ find in files filter EXCLUDE

FindNotepad++

Find Problem Overview


I'm looking for a way to get n++'s find in files dialog to exclude certain files...

the only reference I've found so far is this http://sourceforge.net/project/shownotes.php?release_id=536795&group_id=189927 , but, unfortunately, it doesn't work.

I'm using *[^*.dll] to, I think, search for everything BUT dll files.

How can I resolve this ?

Thanks

Find Solutions


Solution 1 - Find

Note, as of December 5th, 2019, Notepad++ 7.8.2 now supports exclude filters. The help documentation describes exclude filters in the Find in Files tab section.

For example to exclude exe, zip and jar files, your 'find in files' filter will look like this;

*.* !*.exe !*.zip !*.jar

Relevant code change in the GitHub commit.

Solution 2 - Find

not that its a GOOD answer, but, what I've found that works is this

*.sql ; *.asp ; *.html ; *.as ; *.mxml

Its definitely not an 'exclude' list, but, by including all the types I need to look at, I get the same result. In my case, I've only got those handfuls of types that I look for often. If your set was wider, this would become even less useful.

Solution 3 - Find

Perhaps the real answer is don't use NP++ for this. Have you looked at http://www.wingrep.com/features.htm or

Edit: I use https://tools.stefankueng.com/grepWin.html these days

Solution 4 - Find

I got a tip from another forum that helped me solve this. Mark the folders you want to exclude as 'hidden'. By default the 'Find in Files' in N++ excludes hidden directories. You can then revert the hidden directories when you're done.

A little tedious, but better than nothing.

Solution 5 - Find

There may be a more elegant way, but you could use PowerShell to get all of the extensions in a folder, and then just remove the ones you don't want. This example gets all of the extensions in the "C:\Program Files\Internet Explorer" folder.

NB: don't forget to surround (Get-ChildItem ... -join ";*" with parentheses.

"*" + ((Get-ChildItem -File -recurse "C:\Users\SomeUser\Documents\Visual Studio 2013\Projects\WindowsService1" | Where {$_.Extension -ne ""}| Select-Object Extension -unique | Sort-Object Extension | Get-Unique -asString  | Select -ExpandProperty Extension | % { $_.ToLower() } | Get-Unique) -join ";*")

This returns:

>*.cache;*.config;*.cs;*.csproj;*.exe;*.jmconfig;*.manifest;*.settings;*.sln;*.txt

Then just remove what you don't want.

Solution 6 - Find

Please note tested with Notepad++ v7.8.7

as n00b has answered

This works:

*.* !*.obj

But this does not work!: *.*;!*.obj => searches no files!

on the other hand this does work *.*; !*.obj

Solution 7 - Find

I just had the same problem and found a 3-step solution:

  1. Search in all files
  2. Copy the result as text in a new Notepad++ tab
  3. Use a regular expression to remove all entries that do not interest you

Here is my RegEx (the two spaces at the start are relevant):

M:\.+?\([^\]+.(csproj|dll)|packages.config|Build.props) (\d+ hits?)([\r\n]+\t.+)+[\r\n]+

All my results where on M:, you will have to adapt the start to what fits your results. If you run a "Replace all" with an empty string it removes all results in files ending with "csproj" or "dll", and also in the files "packages.config" and "Build.props".

Solution 8 - Find

The solution from https://notepad-plus-plus.org/community/topic/10653/exclude-directories-from-the-search/5 is to temporarily set those folders you want to exclude to be 'hidden' folders (hiding just the top level sub-dir is sufficient), and this then stops Notepad++ descending into that sub-directory.

Worked for me just now!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionreidLindenView Question on Stackoverflow
Solution 1 - Findn00bView Answer on Stackoverflow
Solution 2 - FindreidLindenView Answer on Stackoverflow
Solution 3 - FindCAD blokeView Answer on Stackoverflow
Solution 4 - FindShane NView Answer on Stackoverflow
Solution 5 - FindJMieraView Answer on Stackoverflow
Solution 6 - FindphamucView Answer on Stackoverflow
Solution 7 - FindDerJochenView Answer on Stackoverflow
Solution 8 - FindPhilip OakleyView Answer on Stackoverflow