Skip to content

Instantly share code, notes, and snippets.

@jimblandy
Created July 6, 2012 22:59
Show Gist options
  • Save jimblandy/3063226 to your computer and use it in GitHub Desktop.
Save jimblandy/3063226 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Like find, but automatically ignore Mercurial metadata and build trees
# Skip initial path arguments, so we can insert our magic at the start
# of the options.
paths=()
while case "${1--}" in (-* | !) false;; (*) true;; esac do
paths=("${paths[@]}" "$1")
shift
done
exec find "${paths[@]}" \
'(' -name .hg -o -name 'obj-*' -o -name 'obj~' ')' -prune \
-o "${@--true}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment