Created
February 3, 2015 13:58
-
-
Save LnL7/3ad9ca064b7316abe4e6 to your computer and use it in GitHub Desktop.
find with ignorefile support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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