Skip to content

Instantly share code, notes, and snippets.

@joeyates
Last active December 10, 2015 01:58
Show Gist options
  • Save joeyates/4363381 to your computer and use it in GitHub Desktop.
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.
# 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