-
-
Save joeyates/4363381 to your computer and use it in GitHub Desktop.
This is my go to find command.
It searches for files and directories with partial matches of the first parameter.
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
# f - everyday find | |
# usage: | |
# f filename_fragment [path] | |
# skips whatever you list in _exclude_matches | |
_exclude_matches=(bundle .git *.pyc) | |
_excludes='' | |
for _match in $_exclude_matches; do | |
_excludes="${_excludes}-name '$_match' -prune -o " | |
done | |
eval " | |
function my_everyday_find() { | |
find \$2 \ | |
$_excludes \ | |
-name \"*\$1*\" \ | |
-print; | |
} | |
" | |
unset _exclude_matches _excludes _match | |
alias f=my_everyday_find | |
# blog post: http://titusd.co.uk/2012/12/23/my-everyday-find-command/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment