How to add logic to search results in OS X

You can greatly narrow search results in the Finder by adding logical operators to include and exclude specific files.

When searching for items in OS X, you can use the Spotlight menu or perform a Finder search routine. Finder, unlike the Spotlight menu, offers a number of filtering options you can add to your search to narrow down results, and you can even save them as canned searches that Apple calls Smart Folders.

To create a filtered search, simply press Command-F in the Finder, and the foremost window will convert to a search window, or you can start entering a search term in the Finder search bar at the top right of each window.

With the search window active, you can choose to search the computer ("This Mac"), the current folder, or mounted shares for specific files. Below this search scope, you can add a number of metadata filters to narrow your search results. The search may have Kind set to "Any," though you can designate audio files, PDFs, folders, and images, and you can click the plus button to add more filters.

Searching with logical operators in OS X
Adding logic to searches, in this case, will yield all PDF documents modified within the last week, excluding files that have the name "test" or "TimeSheet." Screenshot by Topher Kessler/CNET

By default when you add more filters they are all included, so filter 1 and filter 2 would both be applied to the search results. However, you can apply different logic operators such as "or" and "not" to the search results.

To do this, hold the Option key when clicking the plus button, and filters added will be placed under an operator selector, where you can have the results include "any" of the following filters (logical "or"), have it exclude the items found in the filters (logical "not"), or go with the default "all" inclusive (logical "and").

In this way, you can for example build a search result that will include all PDF documents that were opened within the last week, but not located within a specific folder, and then nest a couple of filters to exclude files with one or more key words in their names.

The possibilities for customizing searches in this manner are almost endless. And as with any other custom search, you can save these searches so you can quickly access them, if needed.

In addition to smart searches, you can apply logic to searches in the Spotlight menu. Simply include capital AND and OR. For example, to locate a file with a name or contents containing either "MacBook" or "Apple," you would search for "MacBook OR Apple" in Spotlight.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Don't Miss
    Hot Products
    Trending on CNET

    HOT ON CNET

    Delete your photos by mistake?

    Whether you've deleted everything on your memory card or there's been a data corruption, here's a way to recover those photos.