I like to search for directories only, and the option ag --list-file-types
is not helpful with that. The reason to stick to ag
is the possibility to pick a file with --path-to-ignore
containing patterns to ignore.
An equivalent command would be fd --type d
.
Use the -G argument, and specify a directory name.
For example, if you wanted to search for the word "foobar" in only your Downloads directory:
ag -G "Downloads" foobar
To search inside a nested directory:
ag -G "Downloads/some_directory" foobar
To search in multiple directories:
ag -G "Downloads|Documents" foobar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With