Ack — Ignoring multiple directories without repeating the flag

ack
SparrwHawk picture SparrwHawk · Dec 16, 2013 · Viewed 11.8k times · Source

Is it possible to ignore multiple directories in Ack, without repeating the flag?

e.g. I know the following works (i.e. setting multiple flags):

ack --ignore-dir=install --ignore-dir=php 'teststring'

I was hoping that I could separate directories with commas, like I can do with the extensions as follows:

ack --ignore-file=ext:css,scss,orig 'teststring'

However, the following comma separated ignore flag doesn't work:

ack --ignore-dir=install,php 'textstring'

Is it possible to use some short-hand equivalent, so I don't have to repeatedly type out the --ignore-dir flag?

Answer

Mandar Pathak picture Mandar Pathak · Feb 13, 2014

It's actually similar to how you would specify the include patterns for grep:

ack <term> --ignore-dir={dir_a,dir_b}

However, This format does not work with a single directory. So

ack <term> --ignore-dir={log}

will not work.