Using Spotlight from the Command Line
There's an excellent article from here from Mohit Muthanna about how to use Spotlight from the mac command line.
At its simplest, you just use the mdfind command with what you want to search for as the argument. e.g.
mdfind purplecow
Not only is it a lot less typing than the find command, it's considerably faster.
And if you want to restrict it to a directory, you can use the -onlyin flag, so that
mdfind -onlyin ~ purplecow
is pretty much functionally equivalent to
find ~ -name "*purplecow*" -print
It seems as if the path for mdfind, needs to be absolute, however, so ~ and `pwd` are OK, but . isn't.
0 Comments:
Post a Comment
<< Home