My Everyday find Command


When I'm searching for files, I use this function:

# f - everyday find
# usage:
#   f filename_fragment [path]

# skips whatever you list in _exclude_matches
_exclude_matches=(bundle .git *.pyc)

for _match in $_exclude_matches; do
  _excludes="${_excludes}-name '$_match' -prune -o "

eval "
function my_everyday_find() {
  find \$2 \
    $_excludes \
    -name \"*\$1*\"    \

unset _exclude_matches _excludes _match
alias f=my_everyday_find

It searches for files and directories with partial matches of the first parameter:

$ f 26

If I supply a second parameter, it is taken as the directory to search in:

$ f 26 ..