notepad-plus-plus icon indicating copy to clipboard operation
notepad-plus-plus copied to clipboard

Notepad++ exclude folder find in files filter

Open evandrocoan opened this issue 10 years ago • 59 comments

Notepad++ exclude folder on the Find in Files filter

Originally posted on: http://stackoverflow.com/questions/4198829/notepad-find-in-files-filter-exclude

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 ?

Is there how to exclude folders from the find in files dialog? I need to exclude the .git folders from the search, as the are very big and there are several of them.

image

evandrocoan avatar Oct 17 '16 13:10 evandrocoan

You can't. It doesn't work of real regular expressions. It uses the windows API and only supports wildcards (*) and I think question marks.

To search in multiple file types use something like *.cpp *.h *.xml

dail8859 avatar Oct 18 '16 14:10 dail8859

Regex in Filters could become one of the best features of Notepad++ :(

nikoudel avatar May 28 '17 10:05 nikoudel

At least every two years I find myself investigating if NotePad++ already has the long wanted "Exclude files filter". I'm not complaining though. Keep up the good work!

robsiera avatar Sep 12 '17 07:09 robsiera

Please add the ability to exclude folders/files in searches.

jim-riley-earthscope avatar Oct 23 '17 21:10 jim-riley-earthscope

Just checking, this isn't fixed yet is it?

Nightblade avatar Apr 07 '19 04:04 Nightblade

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!

PhilipOakley avatar May 04 '19 08:05 PhilipOakley

@PhilipOakley Thanks, but technically that's a workaround isn't it? ;)

Nightblade avatar May 04 '19 10:05 Nightblade

@Nightblade Sometimes...and sometimes sadly...workarounds are all we get. :)

sasumner avatar May 04 '19 12:05 sasumner

@Nightblade Correct, it's just a workaround, until such time as it is included in the (searchable) documentation :wink:

PhilipOakley avatar May 09 '19 15:05 PhilipOakley

Here is a easy solution - go to your project and find .git or whatever folder you want (e.g node_module) and right click then properties.

check as hidden (Apply changes to this folder, subfolders and files).

exclude_folder_from_search_in_notepad++

and then search on notepad++ (do not check "In Hidden Folders")

sudhir600 avatar May 21 '19 07:05 sudhir600

Thank you for this workaround but it would be good to have a long term solution for this.

nico008 avatar Jun 28 '19 10:06 nico008

Still waiting 😜

ghost avatar Aug 03 '19 13:08 ghost

No need to keep waiting for it. You can implement it yourself. If you do not know how to program computers or on C++ specifically, this is a good opportunity for you to learn. However, if you do not have time, you can just keep waiting for it, or hire someone to do it. If you do not have enough money to hire someone, you can save money until you get enough. If you cannot save money, then you have more important things to do and that is the end. I personally, stopped using Notepad++ 3 years ago. Nowadays I use Sublime Text, but I am thinking to migrate to VSCode, if it is not too much slow:

  1. https://forum.sublimetext.com#41375 Sublime Text versus Visual Studio Code in 2019

evandrocoan avatar Aug 03 '19 23:08 evandrocoan

I love notepad++ because it's fast and straightforward. However, lacking the feature of excluding certain folder patterns is a key blocker for we coders: many code repositories have 3rd party stuff in the folder. Searching the repository but without the capability to exclude them has a major performance impact and makes the "search in files include subfolder" unusable most of the time.

nanw1103 avatar Dec 10 '19 02:12 nanw1103

Just an idea, but nothing is promised (I have to check the code). Do you guys think the following syntax is feasible? Or has anyone here a better syntax for it? *.* -FfolderName2Exclude1 -FfolderName2Exclude2

donho avatar Dec 10 '19 10:12 donho

Most useful to me would be a list of folder name globs (i.e. wildcard support) somewhere in the Preferences dialogue. That would allow me to always exclude folders named bin or obj, and folders whose names start with a dot: .*;bin;obj.

Because folder names with spaces are not uncommon, I would suggest the semi-colon as the separator between globs.

xylographe avatar Dec 10 '19 12:12 xylographe

Most useful to me would be a list of folder name globs (i.e. wildcard support) somewhere in the Preferences dialogue.

I don't think it's a good idea:

  1. Adding more items in preference dialog make it more complex.
  2. If user puts a folder name by accident and forget to remove it, the folder will always ignored while searching and he/she will never understand why.

I love KISS, and I believe keep Find in files filter settings in the Find in file is the best way. Your filter will be memorized anyway so why bother to make things more complicated?

donho avatar Dec 10 '19 14:12 donho

Because folder names with spaces are not uncommon

Good point.

I would suggest the semi-colon as the separator between globs.

But since space has been used as separator, and we continue using it after the exclusion of files, I would keep it. Here is suggested solution:

*.* -FfolderName2Exclude1 -F"folder name with space to exclude"

donho avatar Dec 10 '19 14:12 donho

I agree, space separator and double quotes is better than ; separator.

To me the location (Preferences or Find dialogue) is not important, I can see why you would prefer the Find dialogue. But, I would prefer to keep the current file filter as is, i.e. file name globs only, and add a new folder-exclude field to the Find dialogue, because filtering on file type depends very much on the type of project (e.g. *.cs !*.Designer.cs makes sense for a CSharp source code project, while *.srt *.ssa *.ass *.xml could be useful for a collection of subtitles), while folder exclusion is not project specific (e.g. .* folders are typically used for bookkeeping purposes by auxiliary tools).

xylographe avatar Dec 10 '19 15:12 xylographe

add a new folder-exclude field to the Find dialogue

I second that!

robsiera avatar Dec 10 '19 15:12 robsiera