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
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.
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:
- Find What: this is the search string that you want Notepad++ to find in the files.
- 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.
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).
Now read: Trimming the Fat in Notepad++