find replace text in files.png

Notepad++ has been a long time favorite app of mine when it comes to text editors. It seems to have the right mix of features, and if you use it enough you’ll start coming across some gems that can really save time. One of the features I want to focus on here is the “Find in Files” functionality that is extremely easy to overlook.

To get to the Find in Files section all you have to do is open up the find/replace dialog and switch to the respective tab (pictured in the screenshot above). Most people I talk to about this feature say that they’ve never even navigated to that tab because the Find and Replace tabs generally conquer all of their bulk editing needs. It’s true that those tabs have a lot of functionality, but Find in Files definitely deserves the space it occupies.

When switching to the Find in Files tab you may not immediately notice how this is different than the Find tab. The Filters and Directory fields (along with a few of the checkboxes) are the notable differences. This is where you can specify a directory you want Notepad++ to crawl and bulk edit files without having to first open them in Notepad++. Using the filters you can have it restrict results to certain file extensions, and the checkboxes off to the side will control its ability to crawl into hidden folders and sub-folders.

I’d like to present you with a small warning though. Before doing a bulk replace you should perform a Find All so that you can see a list of matching files along with the line numbers that will be modified:

notepad bulk find.png

Why? Once you choose the Replace in Files option you’ll see a brief warning confirming that this is what you want to do, and then it will go on its merry way updating all matching files. No backups are made, and it won’t tell you which files were changed. Personally I think it should also return a list of all the files it modified along with a glance of the text before/after the change, but that’s just me.

Generally I just use this for the finding capabilities, which also has one other nifty aspect I haven’t mentioned yet. You can actually double-click on any line number in the result list to instantly have Notepad++ open that file and take you to that line number. Alternatively you can right-click in the result pane and select the Open All option to have all of the matching files opened in different tabs.

I have some other Notepad++ tips that I’ll be sharing later on… so be on the lookout if you enjoyed this article.

Notepad++ Homepage (Windows only; Freeware)