Question regarding new find-in-files filter excluding ability in version 7.8.2
-
Ah, I see. Thanks for the response. Hopefully, one day an exclude-these-directories option will be added to the Find in Files dialog. That would be really great. :)
-
@Alan-Kilborn said in Question regarding new find-in-files filter excluding ability in version 7.8.2:
!*.bin
I’ve added a Pull Request to include that example in the Searching > Find in Files docs. It should be merged by this weekend; when it gets released is out of my control.
-
I found the tooltip that provides help on the feature.
It wasn’t where I expected it.
I expected it to appear when you hover (and stop moving the mouse) over the box you fill in for the filters, but no, you have to point to (and pause over) theFilters :
label itself: -
@Markus-Kemp109 said in Question regarding new find-in-files filter excluding ability in version 7.8.2:
Hopefully…an exclude-these-directories option will be added
The issue ticket that resulted in the exclude files behavior actually started as a ticket to exclude directories. As of this writing, I think the addition of a directory exclude is being actively worked on.
-
Hello, @markus-kemp109, @peterjones, @alan-kilborn and All,
Additional points regarding the
Filters
entry box, of the Replace in Files dialog :-
If the
Filters
box is empty , it means*.*
( Trivial ! ) -
The inclusive mask does not need to be the first item. For instance,
!*.exe !*.log *.*
would scan all files of the given directory ( and, possibly, its sub-dirs ), except for those with extension =exe
andlog
-
The excluding symbol
!
is not a problem if, exceptionally, a filename begins with the!
character. For instance, if the scanned directory contains a file!Test_3.xml
the mask!!Test*.* *.xml
would scan allxml
files whose name do not begin with!Test
-
Note that you cannot just write an exclusive mask, alone ! For instance, the
!*.log
filter does not scan any file :-(( Personally, I think that!*.log
should, implicitly, mean!*.log *.*
i. e. it would have scanned all files, except for those with extension =log
Note that this last point is wrong, since Notepad++
v7.8.7
. Refer hereBest Regards,
guy038
-
-
@guy038 said in Question regarding new find-in-files filter excluding ability in version 7.8.2:
The excluding symbol ! is not a problem if, exceptionally, a filename begins with the ! character. For instance, if the scanned directory contains a file !Test_3.xml the mask !!Test*.* *.xml would scan all xml files whose name do not begin with !Test
But you could have a problem on your hands if you need to search files that match
!Test_*.xml
, such as!Test_3.xml
,!Text_4.xml
… :-) -
@Alan-Kilborn That sounds awesome. Thanks for the info. :)
-
Hi, @markus-kemp109, @peterjones, @alan-kilborn and All,
Yes, Alan, your’re right about it. I haven’t noticed that, yet !
So I created four test files
Test.txt
,Test_2.xml
,!Test.txt
and!Test_2.xml
, from any non-emptyxml
file, in the folder of my local installation of N++v7.8.2
:Then :
-
Open the Find in Files dialog (
Ctrl + Shift + F
) -
SEARCH
Notepad
-
REPLACE
$0
( just in case I run the replacement by mistake ! ) -
DIRECTORY
Notepad++ folder
-
Search mode
Regular expression
-
FILTERS One of the
6
cases, below-
*xml
=>13
files listed in the Find result panel, not including the emptydoLocalConf.xml
file -
*.xml !test*.xml
=>11
files listed ( Correct : all but the twoTest.txt
,Test_2.xml
files ) -
*.xml !!test*.xml
=>11
files listed ( Correct : all but the two!Test.txt
and!Test_2.xml
files ) -
test*.xml
=>2
files listed ( Correct : only the the twoTest.txt
,Test_2.xml
files ) -
!test*.xml
=>0
files listed ( Logic as the inclusive filter is missing ) but incorrect because it should mean, either :-
All files except for the files
Test.txt
andTest_2.xml
-
Only the two
!Test.txt
and!Test_2.xml
files
-
-
!!test*.xml
=>0
files listed ( Logic as the inclusive filter is missing ) but incorrect because it should mean, either :-
All files except for the files
!Test.txt
and!Test_2.xml
-
Only the two, non-created files,
!!Test.txt
and!!Test_2.xml
-
-
Note that the forbidden characters, in Microsoft filenames are the nine following symbols :
\
,/
,:
,*
,?
,"
,<
,>
and|
So, although the case of filenames, beginning with the
!
exclamation mark, must be rather rare, I think that using the|
symbol to express the negation concept, in theFilters:
zone, would have been a more appropriate symbol ;-))And of course, an unique syntax
|Test*.xml
, beginning with the|
symbol, would have implicitly meant the syntax*.* |Test*.xml
Best regards,
guy038
-
-
I think that
|
, while a good choice because it is not allowed in filenames, is a bad choice because C-family programmers are used to it being an “or” operator, which for this application would really be misleading! -
@alan-kilborn and All,
Oh, my bad ! Of course, it would not be the best choice as, instead, the
!
symbol is curently used, inC
, to mean, both, different of (!=
) and the logical NOT operator (!
)Now, I’m stuck : there isn’t any other symbol, which clearly suggests the negation concept ! Of course, we may rename any file beginning with the
!
symbol but, finally, the best choice would be a newExcluding:
zone ;-)) in the Find in Files dialog, wouldn’t it be ?BR
Guy038
-
I think it was decided that
!
usage as the first character in a filename was rare enough to not cause a real problem here. Adding additional GUI elements is problematic because it takes up precious screen area and then has to be translated into all kinds of languages. Not huge problems, but I think the current prefix of!
is pretty reasonable, so I would vote to leave it the way it is. -
@guy038 said in Question regarding new find-in-files filter excluding ability in version 7.8.2:
Note that you cannot just write an exclusive mask, alone ! For instance, the !*.log filter does not scan any file :-(( Personally, I think that !*.log should, implicitly, mean !*.log *.* i. e. it would have scanned all files, except for those with extension = log
This has been changed in Notepad++ 7.8.7 so that you can write exclusive mask(s) alone. See HERE and note point #12 of the change log:
12. Allow user to skip *.* when adding only excluding Filters for Find/Replace In Files.