Quantcast
Channel: Silver Searcher: How can I only return results in folders matching a pattern? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Silver Searcher: How can I only return results in folders matching a pattern?

$
0
0

My file structure is like this:

A   G (want to ignore)   H (want to ignore)   X (contains files I want to search)B   G (want to ignore)   H (want to ignore)   X (contains files I want to search)C (want to ignore)X (contains files I want to search)

I want to only return results where X is somewhere the directory path.

It looks like I could use ag foo --ignore={G,H} but the list of folders to ignore would be very (almost prohibitively) long. I normally want to search in ALL of the folders so I could manually construct a global ignore file with everything and swap it in place when I want to ignore mostly everything.

I found that this syntax lets me search within A and B's X folder so I'm close!

ag foo */X

So the question is essentially: How can I have an arbitrary number of forward slashes (0, 1, or more)?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images