Be a Spotlight Ninja
I recently came across some more powerful commands that are available in OS X’s Spotlight that are just too good to keep to myself. Apple Help has already put together a nice article so rather than reinvent the wheel. . .
Specifying criteria in the Spotlight search field
When you enter the text you want to search for in a Spotlight search field, you can also include criteria to refine the results as Spotlight searches. You can search by phrase or by metadata (data that describes other data) attribute, and perform Boolean queries. You can specify absolute dates and a range of values.
Here are ways to specify search criteria:
■ Phrase
Use quotation marks around text to search for exact phrases — the same way you do with most Internet searches. For example, enter “trip to France” in the search field to find items on your computer that contain that exact phrase. If you didn’t use quotes, the search results would include items that contain any of those words.
■ Attribute
Most items contain metadata that describes the item contents, how it was created, and other attributes. For example, when you take a digital photo, information such as the camera model, the aperture, and the focal length are among the many attributes automatically stored in the file as metadata. Here are examples of what you might type in the search field when you search using metadata attributes:
trip kind:document searches for the word “trip” in documents only
author:tom searches for all items written by Tom
meeting date:tomorrow searches for meetings you have planned for tomorrow
kind:images created:5/16/07 searches for images created on a specific date
kind:music by:”glenn miller” searches for music by Glenn Miller
modified:<=6/29/07 searches for items modified on or before a specific date
■ Boolean query
A Boolean query is a search that uses AND, OR, and NOT (known as Boolean operators) to narrow results. You can also use a dash (-), meaning AND NOT, to exclude items when you search. Here are examples of what you might type in the search field when you search using Boolean operators:
author:tom OR author:thom searches for items authored by Tom or Thom, in case you don’t know the exact spelling of his name
trip -france searches for items that contain the word “trip” but not “france,” so results might include photos from a trip to Spain but not to France
kind:message date:6/29/07-7/25/07 NOT date:7/14/07 searches for email messages dated from 6/29/07 through 7/25/07, but excludes those dated 7/14/07
To view metadata for a file, Control-click the file in the Finder and choose Get Info from the pop-up menu.
Personally I find the kind attribute indispensable for quickly cutting down the results when I know I’m looking for a folder, video, or what have you. Enjoy!