Easily search for files based their names or glob patterns, by wrapping Spotlight.
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
#!/usr/bin/env bash | |
# case-insensitive search for $1, maybe in dir $2 | |
case "$#" in | |
0) echo "usage: $(basename $0) PATTERN [DIR]" | |
echo "" | |
echo " Lists paths of files matching PATTERN in DIR or below" | |
;; | |
1) exec mdfind "kMDItemDisplayName == '$1'c" | |
;; | |
*) exec mdfind "kMDItemDisplayName == '$1'c" -onlyin "$2" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment