Skip to content

Instantly share code, notes, and snippets.

@LnL7
Created February 3, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LnL7/3ad9ca064b7316abe4e6 to your computer and use it in GitHub Desktop.
Save LnL7/3ad9ca064b7316abe4e6 to your computer and use it in GitHub Desktop.
find with ignorefile support
ffind() {
local -a ignoreargs ignores args
if [[ -e $HOME/.ffignore ]]; then
ignores=( ${(f)"$(< $HOME/.ffignore)"} )
for ignore in $ignores; do
ignoreargs+=( -o -name "$ignore" )
done
fi
while true; do
case "$1" in
-*) args+=($1); shift; ;;
*) args+=($1); shift; break ;;
esac
done
find $args \( -path '*/\.*' $ignoreargs \) -prune -o ${@:--print}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment