Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Use mdfind to run saved Spotlight searches UNIX
I noticed that mdfind has become much more useful now in Leopard. For instance, you can run Finder saved searches from the command line. As an example...
mdfind -s "Pet Pics"
...will show the results of saved search called "Pet Pics." It actually looks for the saved search in ~/Library/Saved Searches, but you can give it a full file path if you wish. This means you can build up your queries visually using Finder, then easily use them in scripts. Also, you can give mdfind queries in the same language that you'd use in Spotlight:
mdfind -interpret "pet kind:image"
As usual, check man mdfind page for more info, but note that the man page is not consistent with all that mdfind can do (eg, it doesn't mention -s in the man page).
    •    
  • Currently 2.67 / 5
  You rated: 4 / 5 (6 votes cast)
 
[10,658 views]  

10.5: Use mdfind to run saved Spotlight searches | 3 comments | Create New Account
Click here to return to the '10.5: Use mdfind to run saved Spotlight searches' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Use mdfind to run saved Spotlight searches
Authored by: JimAkin on Dec 31, '07 10:44:38AM

FWIW, this seems to work in OS X 10.4.11, too.

---
Jim



[ Reply to This | # ]
10.5: Use mdfind to run saved Spotlight searches
Authored by: KidneyPi on Jan 01, '08 08:12:26AM
The man page doesn't mention this, but the usage info does. Run mdfind without any arguments and it will show this option. It won't show the interpret option.

[ Reply to This | # ]
10.5: Use mdfind to run saved Spotlight searches
Authored by: wgscott on Jan 01, '08 04:52:33PM

Anyone know how to do the inverse operation, i.e., save the search pattern as a saved search xml file?



[ Reply to This | # ]