Note: Scroll down to quickly find the solution.
Today I needed to configure an instance of JBoss to connect to a postgres DB. I remembered that I’ve done it before, but couldn’t remember much more than that. So I thought I would fire up Sublime Text and take advantage of its “Find in Files” feature that, like many other programs that share similar functionality, will search within a given set of directories for a pattern.
It worked very well except there was a lot of noise in the results. Turns out JBoss keeps a history of its configuration in a subdirectory. The numerous copies upon copies of the same configuration files were slowing down the search and causing the same results to essentially repeat themselves.
In the GUI, when you go to add to your “Where” clause, telling Sublime Text which folders to search, there isn’t an obvious option to exclude specific folders.
“Add Exclude Filter” seems like a perfect candidate. It will let you filter out files that you want to ignore, such as “*.log” to ignore all log files. But what’s not immediately obvious is the pattern to ignore folders.
Using a Linux style forward slash to denote directory structure, you can simply make use of the same asterisk to make it a pattern. So to exclude every occurrence of the “standalone_xml_history” folder, the pattern becomes:
And to negate it, meaning to exclude that folder, simply add a dash, just like a normal negating filter.
So my entire “Where” clause to search through JBoss config files ended up being the following: