Use Notepad++ to find text in all files of a folder

Martin Brinkmann
Sep 16, 2016
Updated • Nov 14, 2019
Tutorials
|
24

Notepad++ is quite the versatile text editor for Windows even if you ignore the program's plugin system for a moment which extends it even further.

One of the features that I make use of regularly is the program's ability to search for text in all files of a folder that I specify.

Today for instance I was informed that the cookie handling for users who leave comments here on this site changed.

All I knew was that the cookie expiration time was set to the same day and not the next year. I suspected one of the plugins installed on the site responsible for that, but did not know which.

While I could analyze the issue using trial and error, by disabling plugins one by one and verifying if that operation resolved the issue, I decided to use NotePad++ for that instead.

The idea was to search through all plugin files and return any lines of code that would either alter cookies, or search for specific variables.

Find text in all files of a folder

notepad find in files

Start Notepad++ on your system to get started with the operation. You don't need to open a text file in the program on start, as it does not matter for the find operation that you are about to run.

Select Search > Find in Files from the menu. If you like keyboard shortcuts better, use Ctrl-Shift-F to open the search window instead.

find in files

The find in files configuration window is pretty easy to use as you can ignore most options if you don't require them.

What you need to configure are the following fields:

  1. Find What: this is the search string that you want Notepad++ to find in the files.
  2. Directory: this is the root folder that contains all the files that you want searched. Notepad++ searches all subfolders as well by default.

All other fields are optional. If you leave everything as is, Notepad++ will crawl all files of the selected root folder and all subfolders that it contains, and return all hits at the end of the search.

Optional parameters may be useful however. You can change filters, so that only certain file types, e.g. *.css or *.php, or file names, finance.* are included in the search.

You may also enable match whole word or match case options, or switch from a normal search mode to an extended search mode or one that uses regular expressions.

Last but not least, you may use the replace option to replace the text you entered with other text.

Click find all to get started. The search time depends largely on your selection, but should not take long.

Notepad++ returns all hits sorted by file and line afterwards.

search text in files

All that is left is to go through the results line by line to find what you are looking for (which I did not by the way, but that is another story).

Notepad++

For Windows

Now read: Trimming the Fat in Notepad++

Summary
Use Notepad++ to find text in all files of a folder
Article Name
Use Notepad++ to find text in all files of a folder
Description
Find out how to use the text editor Notepad++ on machines running Windows to find text in all files of a folder that you select.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Previous Post: «
Next Post: «

Comments

  1. Anonymous said on August 30, 2022 at 1:05 pm
    Reply

    FYI you can also right click on the search results and select the option to copy pathname(s) in v8.4.4 on windows anyway

  2. Anonymous said on May 25, 2022 at 11:35 am
    Reply

    Thank you for this awesome tip..!

  3. adj said on January 22, 2021 at 1:44 pm
    Reply

    Alas, on my first try, Notepad++ was not very effective. I searched my Docs folder for the text string “Adam Smith”, andeonly one instance was found – although I know there are at least 10 from W10 Search. Will try other progs, but thanks for the suggestion.

  4. Scorpion said on March 12, 2020 at 10:30 am
    Reply

    Search Note is an impressive way to search content inside your shared documents.
    Why don’t you give it a try? Search note is available on github.
    https://github.com/scorpionit01/SearchNote

  5. dupont said on March 28, 2019 at 1:19 pm
    Reply

    Merci beaucoup depuis la France ;-)

  6. Martin said on September 11, 2018 at 4:58 pm
    Reply

    muchas gracias desde Argentina!!!

  7. Ramesh said on January 24, 2018 at 7:51 pm
    Reply

    Thanks for a nice tip!

    Could you please let me know if we can enter the string values (to be searched) from a specific NPP file (say reference.txt) and then perform a search of all values present in that input file “reference.txt”.

  8. Jojo said on April 18, 2017 at 2:00 pm
    Reply

    Doesn’t work for me on a Right to Left lang…
    Searched for words I know exsist in my txt files in My Documents, for example… Tried 2 words, 1 word… Nada. Single letter search seems to have worked…
    Should it matter whether I’m using a Portable or an Installed N++? I guess not, right?

    Bummer

    p.s.
    On another happier note – I see Ghack’s directed to a HTTPS now – at last, nice!!

  9. JOSEPH DUNN said on April 18, 2017 at 10:29 am
    Reply

    THIS PROGRAM SUCKS BIG TIME. AFTER I HAD NOTBOOK++ CHANGE MY ALL MY STUFF IN MY FOLDERS, NOW I CAN’T ACCESS MY STUFF NOW. THIS DOES NOT WORK WELL!!!! MY RESPONSE IS THIS…
    SECURITY BLAH BLAH BLAH…

  10. Jes said on April 7, 2017 at 1:04 pm
    Reply

    Hi,
    I have one doubt.
    after searching a particular word ,how to go to parent page ? is there any short key for that ?

  11. Elvinson said on February 16, 2017 at 7:03 am
    Reply

    Thank You. it is working 100%

  12. C said on September 19, 2016 at 8:28 pm
    Reply

    Excellent tip Martin.

    One feature that some people may not realize is there.

    PSPad is another free editor. It has support for a wide range of file types.
    It searches in directories, and sub-directories too. Its also free.

    TextPad is very good and offers a similar feature list to PSPad. Its not free though.

  13. chesscanoe said on September 17, 2016 at 11:32 pm
    Reply

    I love NotePad++ and have been using it for years. However for my purposes, I prefer to find specific content, in text files for example, by invoking UltraSearch. I’m not claiming it’s best; perhaps it’s just what I’m used to.

  14. Jojo said on September 17, 2016 at 7:45 pm
    Reply

    Nice article!
    Wasn’t aware of that option, and to be honest haven’t used the in a very long time!
    What I’ve been using for text search instead is my file search program, called ‘locate32’,i think it works ;)
    But imma check it out!
    Thanks

    1. A different Martin said on September 17, 2016 at 8:11 pm
      Reply

      Yeah, I didn’t know about it either. I’m not a coder, so I don’t have much call for advanced functions in programs like Notepad++ and, accordingly, don’t go looking for them. I may check this one out, however.

      I like pulling up XML files (which I do sometimes edit, e.g., for FreeFileSync) in Notepad++ because it does a nice job of coloring the tags and different nesting levels, resulting in fewer mistakes for an incipient Mr. Magoo like me. Also, by default it restores the previous “session” of open tabs. I install multiple versions of LibreOffice as “parallel” (~portable) installs but I have to manually edit each version’s bootstrap.ini file to point it to my LibreOffice user profile. Whenever a new version of LibreOffice comes out, it’s really handy to open its bootstrap.ini file in Notepad++ and have a tab containing a previously revised bootstrap.ini file already loaded and ready to copy from. It saves me the severe mental anguish of having to hunt down a “known-good” bootstrap.ini file each time.

      Anyway, I like Notepad++ well enough, and Don Ho seems to be a pretty nice guy, even though I was disappointed to learn that he doesn’t actually lead a double life, coding in Paris during the day and entertaining tourists in Hawaii at night. (“Tiny bubbles…”)

  15. Pants said on September 17, 2016 at 5:37 pm
    Reply

    On a side note: I had to search two logs files the other with a combined size of 6GB .. LogExpert (not just for log files): haven’t tried any others

  16. George said on September 17, 2016 at 11:35 am
    Reply

    Thanks for the info, Martin. Was wondering if it’s possible to exclude folders from the search. After a quick look it seems it isn’t possible, but a workaround would be to mark the folder you want excluded as Hidden (right-click/Properties). Notepad++ won’t look there by default (“In hidden folders” option, visible in the posted screenshot).

  17. beerpatzer said on September 17, 2016 at 6:43 am
    Reply

    Out of context, but is there a program that lets you “send to” a file regardless of what format it is? If it’s a text file, it would show text, if it’s a picture, it would show you the picture, and if it’s a binary, it would show you the hex code?

  18. Jozsef said on September 17, 2016 at 6:40 am
    Reply

    Would SciTE be the best equivalent for Linux or is there something else? I’m trying to leave the Windows vale of tears. ;)

  19. Nebulus said on September 17, 2016 at 2:15 am
    Reply

    Thanks for the tip, Martin!

  20. Dave said on September 16, 2016 at 9:50 pm
    Reply

    I think Programmers’ Notepad 2 is much better than Notepad++, not least for its stability and Python script support.

    As for the task at hand, I’d use Agent Ransack. It’s old but well maintained and very good at what it does.

    1. A different Martin said on September 17, 2016 at 4:31 pm
      Reply

      An update to Agent Ransack was released (or at least brought to my attention by SUMo) yesterday!

    2. Mark Reed said on September 17, 2016 at 12:40 am
      Reply

      Programmer’s Notepad 2 and Notepad++ are great, however PN2 has not been updated since 2011.
      For lightweight activities, like checking small logs or readme files, I prefer SciTE. Notepad++ being based on Scintilla, allows me to use the same shortcuts as with SciTE.

  21. Relational Datapost said on September 16, 2016 at 8:23 pm
    Reply

    3rd rank in the best editors list, after Vim and Emacs.
    Just forget hogs as Sublime or Atom.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.