Ignoring folders in The Silver Searcher `ag`

31 views Asked by At

I have a structure like this:

folder_a/
├── a.txt
└── folder_b/
    └── b.txt

where both text files contain 1234 string. Being in folder_a how to use ag from terminal to find only a.txt?

I tried:

  • ag -Qu "1234" --ignore folder_b .
  • ag -Qu "1234" --ignore-dir folder_b .
  • ag -Qu "1234" --ignore-dir={folder_b,} .

and always got

a.txt
1:1234

folder_b/b.txt
1:1234

How to ignore/exclude directory folder_b from the search?

0

There are 0 answers