Skip to main content

findpat: Easing up find through brace expansion

I'm tired of typing minus-name-chains for find like

$ find . -name '*.jpg' -o -name '*.png'

Wouldn't it be nice if instead

$ find . '*.{jpg,png}'

were possible? As find does not expand braces I wrote a little tool to make life a little easier. It's called findpat and either acts as a simple frontend to find (see example 1) or as a expression generator (example 2). Here are a the examples and their plain find equivalents:

$ find . -name '*.jpg' -o -name '*.png'
$ findpat '*.{jpg,png}'
$ find . \( -not -executable \) -a \( -name '*.awk' \
    -o -name '*.sh' \)
$ findpat -p '*.{awk,sh}' | \
    xargs find . \( -not -executable \) -a

The complete usage currently looks like this:

$ findpat --help
USAGE
  findpat [-v|--verbose] [<dir>] <pattern>
  findpat -p|--print <pattern>
  findpat -h|--help
  findpat -V|--version

You can download findpat 1.0 here: