Find your files on Mac
I love Spotlight on Mac but wanted to explore a few other tools. Here are a few of my favorites.
DocFetcher
I really like DocFetcher. It's a Java program that runs on all Operating Systems and you can even put it on a USB with an index that leads to other files on the USB. DocFetcher can index all sorts of files including PDF, Microsoft Office, ID3 tags within an MP3. I found it easier to work with then beets.
mdfind
mdfind
is the Terminal equivalent of Spotlight. It's very powerful and most important of all, scriptable. Below are a few common commands.
mdfind -name rails
mdfind "rails" -onlyin ~/Documents/
mdfind "kind:image date:yesterday"
mdfind 'kMDItemFSCreationDate < $time.today(0) && kMDItemFSCreationDate > $time.today(-1) && kMDItemKind = *image'
ACK
ack
is a search tool designed for code. It's built to be a customizable replacement for grep with higher speed, automatic recursion, and is able to skip unimportant files.
brew install ack
ack rails
ack --js vue
Find
find . -type f -exec grep -l rails {} +
find <~/Documents> -iname "*.<filetype>"
find #{dir} -type f -name "*.#{type}" 2>/dev/null
Grep
Grep is not my favorite replacement to Spotlight but it has its use cases. Warning: This may take a very long time.
grep -r "rails"
grep -r -l "rails" ~/Documents/