How do I search text in a specific directory?


#1

I used to type MyDirectory/*.cpp in Sublime Text’s filter to search for a text in files that are under a directory. This is handy because it’s faster than searching the whole project all the time, it focuses the results and I don’t need to write the full path from the project’s root.

In Atom I tried that, but got no results. I tried to write The/Entire/Path/To/MyDirectory/*.cpp, no luck either.
if I just write *.cpp I get something, but it’s very slow and results are cluttered.

How can I specify a file filter just the same as in Sublime?


#2

Globbing in Atom is a bit different than the one in ST, to search in all *.cpp files in MyDirectory and its descendants you’ll have to use MyDirectory/**/*.cpp, MyDirectory/*.cpp will only search in the files at the root of MyDirectory.


#3

Yes, it works! It’s a bit more complicated than I thought…
Thanks!

EDIT: even after restricting folders (50 files to search instead of 2000), it’s still very slow, I wonder if it really optimizes where Atom actually searches…