Community
    • Login

    How can I do a search that results including/highlights the file name, the folder and the HDD name?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 139 Views 2 Watching
    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.
    • pellelinP Offline
      pellelin
      last edited by pellelin

      Hello!

      I have created a Notepad++ file with 452036 lines (36,1 MB) of textfiles, from HDD directories, folders and files.
      Folders have this in folder name --=[ (any letters, numbers following)
      Drives have their names like this [ A ] [ WD-1 ] etc.
      Here some screendumps of HDD and folders.
      01.png 02.png 03.png 04.png 05.png
      The directories are in 5 levels of subdirectories.
      Each HDD is named [ A ] [ B ] or [ WD-1] [ WD-2 ] etc. and file names, like filename.jpg, filename.txt etc.
      Doing a normal search I can find the folder, files or HDD drive name, but not listed together in the same search.

      How can I do a search that results will include and highlights the file name, the folder and the HDD name [ WD-1 ] [ WD-2 ]?
      So if I do a search like this:
      filename
      I would like to get the result that includes
      filename, folder and in what [ ] HDD drive the file and folder sits.

      I don’t know if this can be done but it would be of great help if it could.
      As of now I have to scroll forever to find the right HDD…

      Thanks and best regards,
      pellelin

      PeterJonesP pellelinP 2 Replies Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @pellelin
        last edited by PeterJones

        @pellelin ,

        Your vague descriptions of text don’t make it clear to me what your text is actually like.

        Could you use the ``` notation (from the </> button on the post toolbar) to put some example text? Like

        ```
        [ A ] blah blah blah filename blah blah
        [ B ] blah blah blah notsamefile blah blah
        [ WD-40 ] is good for cleaning hardware
        ```
        

        which will render like

        [ A ] blah blah blah filename blah blah
        [ B ] blah blah blah notsamefile blah blah
        [ WD-40 ] is good for cleaning hardware
        

        In the mean time, assuming you wanted to highlight the entire line that includes specific filename, it could be done with:

        • FIND = (?-s)^.*filename.*$
        • SEARCH MODE = Regular Expression

        If you actually only want to highlight part of each line, you’re going to have to give example text that reasonably matches your actual data, and then do a screenshot showing which you’d like to highlight given a specific search example.

        1 Reply Last reply Reply Quote 0
        • pellelinP Offline
          pellelin @pellelin
          last edited by pellelin

          @peterjones
          Hello!

          Many thanks for your reply, much appreciated!

          [ WD-1 ] [ WD-2 ] etc. is the name of the drives given by me.
          Windows assigns the drives as (D:) (E:) (F:) (G:) etc.
          I use a software that creates the directory list, with chosen levels 5, 6 or more if needed.
          I create a directory list of each HDD and then combine each list to a large .txt file, to do the search for files from.
          Many large HDDs, many directories, thousands of files = a huge .txt file…

          Edit/ Forgot to thank you for the Regular expression, thanks!

          Here is an Example of directories and files.01-search.png 02-result-1.png 03-result-2.png

          [ WD-1 ]
          
          F:\Example\
          F:\Example\Animated.gif
          F:\Example\Example.txt
          F:\Example\This is a video from the countryside.mp4
          
          F:\Example\--=[ Illustrator\Projects\2024 ~ ~\
          F:\Example\--=[ Illustrator\Projects\2024 ~ ~\project four.ai
          F:\Example\--=[ Illustrator\Projects\2024 ~ ~\project one.ai
          F:\Example\--=[ Illustrator\Projects\2024 ~ ~\project three.ai
          F:\Example\--=[ Illustrator\Projects\2024 ~ ~\project two.ai
          
          F:\Example\--=[ Images\CRC is good for Contact Clean & Protect\
          F:\Example\--=[ Images\CRC is good for Contact Clean & Protect\1754387contactcleanprotect250mlh600-rgb.jpg
          F:\Example\--=[ Images\CRC is good for Contact Clean & Protect\CRC is good for Contact Clean & Protect.png
          
          F:\Example\--=[ Images\Vacation\2025\Cities\
          F:\Example\--=[ Images\Vacation\2025\Cities\another town.jpg
          F:\Example\--=[ Images\Vacation\2025\Cities\old town.jpg
          F:\Example\--=[ Images\Vacation\2025\Cities\ruins.jpg
          F:\Example\--=[ Images\Vacation\2025\Cities\this town.jpg
          
          F:\Example\--=[ Images\Vacation\2026\
          F:\Example\--=[ Images\Vacation\2026\city.jpg
          F:\Example\--=[ Images\Vacation\2026\fields.jpg
          F:\Example\--=[ Images\Vacation\2026\stormy.sea.jpg
          F:\Example\--=[ Images\Vacation\2026\woodlands.jpg
          
          F:\Example\--=[ Images\WD-40 Multispray\
          F:\Example\--=[ Images\WD-40 Multispray\WD-40 Multispray.jpg
          
          F:\Example\--=[ Photoshop\Projects\2024 ~ ~\PNG-transparent\
          F:\Example\--=[ Photoshop\Projects\2024 ~ ~\PNG-transparent\printproject .png files.png
          
          F:\Example\--=[ Photoshop\Projects\2024 ~ ~\PSD\
          F:\Example\--=[ Photoshop\Projects\2024 ~ ~\PSD\birthday-grandchildren print files.psd
          F:\Example\--=[ Photoshop\Projects\2024 ~ ~\PSD\print project .psd files - Copy.psd
          
          F:\Example\--=[ Text\Documents\Notepad++\
          F:\Example\--=[ Text\Documents\Notepad++\[ WD-1 ].txt
          F:\Example\--=[ Text\Documents\Notepad++\[ WD-2 ].txt
          F:\Example\--=[ Text\Documents\Notepad++\[ WD-3 ].txt
          
          F:\Example\--=[ Text\Documents\Word\
          F:\Example\--=[ Text\Documents\Word\ABC.docx
          F:\Example\--=[ Text\Documents\Word\DEF.docx
          F:\Example\--=[ Text\Documents\Word\GHI.docx
          
          F:\Example\--=[ Video\--=[ Hires\Vacation\1920x1080\
          F:\Example\--=[ Video\--=[ Hires\Vacation\1920x1080\Berlin.mp4
          
          F:\Example\--=[ Video\--=[ Lowres\Family\1080x720\
          F:\Example\--=[ Video\--=[ Lowres\Family\1080x720\Paris.mp4
          
          [ WD-2 ]
          
          G:\Example\
          G:\Example\Animated Dog.gif
          G:\Example\Example 2.txt
          G:\Example\This is a video from the lakeside.mp4
          
          G:\Example\--=[ Illustrator\Projects\2024 ~ ~\
          G:\Example\--=[ Illustrator\Projects\2024 ~ ~\project eight.ai
          G:\Example\--=[ Illustrator\Projects\2024 ~ ~\project five.ai
          G:\Example\--=[ Illustrator\Projects\2024 ~ ~\project seven.ai
          G:\Example\--=[ Illustrator\Projects\2024 ~ ~\project six.ai
          
          G:\Example\--=[ Images\CRC is good for Contact Clean & Protect\
          G:\Example\--=[ Images\CRC is good for Contact Clean & Protect\contactcleanprotect250mlh600-rgb.jpg
          G:\Example\--=[ Images\CRC is good for Contact Clean & Protect\CRC.png
          
          G:\Example\--=[ Images\Vacation\2023\
          G:\Example\--=[ Images\Vacation\2023\lakeside.jpg
          G:\Example\--=[ Images\Vacation\2023\london.jpg
          G:\Example\--=[ Images\Vacation\2023\new-york.jpg
          G:\Example\--=[ Images\Vacation\2023\the atlantic.jpg
          
          G:\Example\--=[ Images\Vacation\2024\Cities\
          G:\Example\--=[ Images\Vacation\2024\Cities\Copenhagen.jpg
          G:\Example\--=[ Images\Vacation\2024\Cities\Helsingfors.jpg
          G:\Example\--=[ Images\Vacation\2024\Cities\Stockholm.jpg
          G:\Example\--=[ Images\Vacation\2024\Cities\Tokyo.jpg
          
          G:\Example\--=[ Images\WD-40 Multispray\
          G:\Example\--=[ Images\WD-40 Multispray\WD-40.jpg
          
          G:\Example\--=[ Photoshop\Projects\2022 ~ ~\PNG-transparent\
          G:\Example\--=[ Photoshop\Projects\2022 ~ ~\PNG-transparent\hoodie .png files.png
          
          G:\Example\--=[ Photoshop\Projects\2022 ~ ~\PSD\
          G:\Example\--=[ Photoshop\Projects\2022 ~ ~\PSD\grandchildren-print files.psd
          G:\Example\--=[ Photoshop\Projects\2022 ~ ~\PSD\print project 2022.psd
          
          G:\Example\--=[ Text\Documents\Notepad++\
          G:\Example\--=[ Text\Documents\Notepad++\[ WD-4 ].txt
          G:\Example\--=[ Text\Documents\Notepad++\[ WD-5 ].txt
          G:\Example\--=[ Text\Documents\Notepad++\[ WD-6 ].txt
          
          G:\Example\--=[ Text\Documents\Word\
          G:\Example\--=[ Text\Documents\Word\JKL.docx
          G:\Example\--=[ Text\Documents\Word\MNO.docx
          G:\Example\--=[ Text\Documents\Word\PQR.docx
          
          G:\Example\--=[ Video\--=[ Hires\Vacation\1920x1080\
          G:\Example\--=[ Video\--=[ Hires\Vacation\1920x1080\Göteborg.mp4
          
          G:\Example\--=[ Video\--=[ Lowres\Family\1080x720\
          G:\Example\--=[ Video\--=[ Lowres\Family\1080x720\Malmö.mp4
          
          [ WD-3 ]
          
          H:\Example\--=[ Photoshop\Projects\2000~ ~\PNG-transparent\
          H:\Example\--=[ Photoshop\Projects\2001 ~ ~\PNG-transparent\horses.jpg
          
          H:\Example\--=[ Photoshop\Projects\2002 ~ ~\PSD\
          H:\Example\--=[ Photoshop\Projects\2003 ~ ~\PSD\children-print files.psd
          H:\Example\--=[ Photoshop\Projects\2004 ~ ~\PSD\printchildren 2022.psd
          
          [ WD-4 ]
          
          I:\Example\--=[ Photoshop\Projects\2005 ~ ~\PNG-transparent\
          I:\Example\--=[ Photoshop\Projects\2006 ~ ~\PNG-transparent\hooligans.jpg
          I:\Example\--=[ Photoshop\Projects\2007 ~ ~\PSD\
          I:\Example\--=[ Photoshop\Projects\2008 ~ ~\PSD\hooligans-print files.psd
          I:\Example\--=[ Photoshop\Projects\2009 ~ ~\PSD\print hooligans 2022.psd
          
          [ WD-5 ]
          
          J:\Example\--=[ Photoshop\Projects\2012 ~ ~\PNG-transparent\
          J:\Example\--=[ Photoshop\Projects\2013 ~ ~\PNG-transparent\hope.png
          
          J:\Example\--=[ Photoshop\Projects\2014 ~ ~\PSD\
          J:\Example\--=[ Photoshop\Projects\2015 ~ ~\PSD\hope.psd
          J:\Example\--=[ Photoshop\Projects\2016 ~ ~\PSD\hopeproject 2016.psd
          
          [ WD-6 ]
          
          pellelinP 1 Reply Last reply Reply Quote 0
          • guy038G Offline
            guy038
            last edited by guy038

            Hello, @pellelin, @peterjones and All,

            Presently, in France, it’s about 10h30 and, unfortunately, I’m not free because I have a dentist appointment -(( But , this afternoon, @pellelin, I’ll be able to give you a solution. derived from this thread :

            https://community.notepad-plus-plus.org/topic/27535/new-displaying-of-the-search-results-panel

            I’ll create a new post where I’ll find out a way to insert, for each line outputed in the Search Result panel :

            • The drive name

            • The complete path

            • The file name

            • And of course, the text of each line containing occurrences of your search


            The trick is to use the notepad++ option Edit > Line operations > Reverse line order because the replacement regular expression needs to get all the lines of a specific file right BEFORE the line containing this specific file name ! Then, after the replacement throughout all the search results, you just need to run again the Edit > Line operations > Reverse line order option to get back the right displaying !

            In the meantime, before I can post my own solution, @peterjones or others fellows will probably be able to elabore this regex replacement for you :-))

            See you later,

            Best Regards,

            guy038

            1 Reply Last reply Reply Quote 0
            • pellelinP Offline
              pellelin @pellelin
              last edited by pellelin

              @guy038
              Hello!

              Oh great news, this sounds promising, finger crossed! :D Thanks for your reply!

              Best regards,
              pellelin

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

                Hi, @pellelin, @peterjones and All,

                @pellelin, see my new version at this location :

                https://community.notepad-plus-plus.org/post/105618


                May be, you do not agree exactly with the displaying and/or you would like the number of hits as well ! No problem : just tell me about it

                Cheers,

                guy038

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors