Have you ever wanted to search for text in all files of a folder? Windows search will allow you to search through a folder, but will return the keyword in the filename by default. That’s great if you want to find a file in the folder, but what if you want to go deeper and search through all files in those folders for a certain keyword? I ran across this scenario recently, and I wanted to share with the community of Sitecore developers because it can be a very useful tool when performing some Development Operations type of tasks to help you troubleshoot when in certain situations as you will see. If you have seen this trick before then, “Amen”, but if not then make this a part of your toolbox!
Let’s just say you are troubleshooting a CD server in a typical 1 CM | 2 CD distributed environment that is having issues still referencing the “master” database. You simply want to find out where all the “master” references are in the App_Config folder and sub-folders without having to open each file manually and check. Can you imagine having to do that? As Kamruz Jaman would say, “Ain’t nobody got time for that!” Notepad++ to the rescue!
All you have to do is the following:
- Download Notepad++
- Open up Notepad++
- Either do a “Ctrl-Shift-F” OR click on “Search” tab then click on “Find in Files…”
- Once you click on that option you will get this “Find in Files” dialog box where you can set your settings for your search. For this example, we will set to “master” in the “Find what” text box and set the “Directory” to “D:\App_Config”. Lastly, we will just ensure the “In all sub-folders” is checked as well as seen below. Please note that you can also do a “Replace in Files” as well and even search in hidden folders:
- Click “Find All” and watch the all the goodness that returns to you!
As you will see below you now have that keyword brought to you in all the files in that sub-folder as well as the filename and path. Not only that but when you double-click on the line item it will appear above in the text editor so you can view and modify.
With this knowledge, now you are armed like a boss to find keywords in files throughout your Sitecore development daily grind that will make you a more productive member of the team. Happy coding!
Pingback: My favourite utilities / tools for Sitecore development – Walking on clouds
I like your number 3 on that list. You should also add to that post to pick up the Sitecore Developer Toolbox off of the Sitecore Marketplace. It makes it much quicker and faster to get to through the content editor verses having to remember the URLs to those tools that are in the admin area.
Thanks for your suggestion. I like your “Sitecore Developer Toolbox” module on Sitecore Marketplace 🙂