Community
    • Login

    Question regarding new find-in-files filter excluding ability in version 7.8.2

    Scheduled Pinned Locked Moved General Discussion
    14 Posts 4 Posters 3.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Markus Kemp109M
      Markus Kemp109
      last edited by

      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 KilbornA 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        @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.

        1 Reply Last reply Reply Quote 3
        • Alan KilbornA
          Alan Kilborn
          last edited by

          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) the Filters : label itself:

          1e252401-15d7-444c-a518-69c81bb9f0d1-image.png

          1 Reply Last reply Reply Quote 2
          • Alan KilbornA
            Alan Kilborn @Markus Kemp109
            last edited by Alan Kilborn

            @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.

            Markus Kemp109M 1 Reply Last reply Reply Quote 3
            • guy038G
              guy038
              last edited by guy038

              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 and log

              • 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

              • 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 here

              Best Regards,

              guy038

              Alan KilbornA 2 Replies Last reply Reply Quote 2
              • Alan KilbornA
                Alan Kilborn @guy038
                last edited by

                @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… :-)

                1 Reply Last reply Reply Quote 2
                • Markus Kemp109M
                  Markus Kemp109 @Alan Kilborn
                  last edited by

                  @Alan-Kilborn That sounds awesome. Thanks for the info. :)

                  1 Reply Last reply Reply Quote 0
                  • guy038G
                    guy038
                    last edited by guy038

                    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-empty xml 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 empty doLocalConf.xml file

                      • *.xml !test*.xml => 11 files listed ( Correct : all but the two Test.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 two Test.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 and Test_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 the Filters: 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

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @guy038
                      last edited by

                      @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!

                      1 Reply Last reply Reply Quote 2
                      • guy038G
                        guy038
                        last edited by

                        @alan-kilborn and All,

                        Oh, my bad ! Of course, it would not be the best choice as, instead, the ! symbol is curently used, in C, 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 new Excluding: zone ;-)) in the Find in Files dialog, wouldn’t it be ?

                        BR

                        Guy038

                        1 Reply Last reply Reply Quote 0
                        • Alan KilbornA
                          Alan Kilborn
                          last edited by

                          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.

                          1 Reply Last reply Reply Quote 2
                          • Alan KilbornA
                            Alan Kilborn @guy038
                            last edited by guy038

                            @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.

                            1 Reply Last reply Reply Quote 3
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors