In OS X, Spotlight is an effective way to search your entire hard drive for a file or folder, email, or any other file. There are many other things Spotlight can do, and searching for files is just one of them. Spotlight is also capable of looking up dictionary definitions, launching apps, performing calculations, previewing audio, video, documents, and other files. This article will outline some of the benefits of using Spotlight and how to use Smart Folders, which allow you to search for a file even if you don’t know its name.

Basic searching
On a Mac, Spotlight can be used to search your hard drive for any file, folder, or email based on the search criteria being in the title or the body. So, if you have a document that you’ve lost, and you aren’t sure of the title, you can search using a word that you know is in the body of the document. This also works for emails.

spotlight search

 

For example, in the search result above, the Documents section displays Evernote,_Getting_Started_925.pages because the word “article” is in the body of the document.

Previewing files in Spotlight
When the search result is displayed, you can mouse over the file name and a preview of it will appear to the left.

spotlight sample by mouseover 2

 

This works for many types of files such as images, documents of all kinds, and more. For audio and video files, you can play or preview the file right in Spotlight, by moving your cursor over the file and clicking the play button.

Determining the location of the file
However, when you see the search result in Spotlight, it does not reveal the location of the file. To determine the location of the file in the search result move your cursor over the file name, and press and hold the Command key, or click “Show All in Finder” at the top. If you press and hold the Command key, first the file name, then the location of the file will be displayed.

If you click “Show All in Finder”,  it opens a new Finder window that displays all the files that meet the search criteria. If you single click on a file, its location is dispayed in the Path Bar at the bottom. If you are not sure if you have located the correct file, press the spacebar to preview it.

Double-clicking on the folder name in the Path Bar to the left of the file name brings you directly to the folder the file is in.

The result of the search might include a large number of files. If that occurs, you may be able to find the file more easily by clicking the List View icon, and then Arrange icon and changing to sort by Date Modified or Name. Also, typing a more specific search in Spotlight may narrow the search result.

spotlight sort

Moving documents with “Move To…”
Pages, Numbers, Keynote, and TextEdit have a handy “Move To…” option on the File menu. For documents like those, it make sense to simply open the document by clicking on it in the Spotlight search result, and the using File > “Move To…” and save the file to the location you want.

Searching by file extension
To search for files by file extension, type the “.” in the search. For example, if you are trying to locate all the Pages files on you your computer you would type “.pages” in your Spotlight search.

spotlight search by extension

 

Tangentially, if you have ever burned DVDs on your Mac, you may be able to free up significant space on your hard drive by searching for “.dvdproj” in Spotlight. If you decide you no longer need a (typically large) DVD project file and delete it, it does not delete the movie from iMovie or Final Cut.

Launching apps
A simple but efficient way to take advantage of Spotlight is to use it to launch apps. To quickly launch an app that is not on your dock, just type the first few letters in Spotlight and press the Enter key.

spotlight launch app

Using Spotlight as a dictionary or calculator
If you type a word in Spotlight, one of the results is a dictionary definition of that word. Moving your cursor over in the search result displays a definition. Clicking on Dictionary opens the Dictionary app, where a thesaurus and Wikipedia view are also available using the buttons at the top.

Customizing Spotlight
To customize Spotlight, type anything in the search area and click Customize Spotlight at the bottom. You can exclude different sources from the search result by unchecking the corresponding checkboxes. This can be worthwhile if you use it frequently.

For example, I choose to exclude Mail & Messages, Contacts and Web History from Spotlight searches because I find those results distracting. If I want to search for data in any of those apps, I can simply open up the app and search within it.

Using Smart Folders
If you are looking for a file that you don’t the the name of, Smart Folders can be helpful. This can be especially true of image files where you don’t know the name because it was assigned by a camera. To search for files when you don’t know the name, open Finder and choose New Smart Folder from the File menu, or on the keyboard, use Command-Option-N. Click on the + sign on the top right and change “Any” to the kind of file you are looking for, such as “Image” or “Document.”

Then, click the + sign again, and and choose an additional criteria to search with such as Created Date. Type a number in the box to the right of “within last.” The example below would narrow your search result to all images on your computer that were created within the last 7 days, regardless of their name.

If you need to search for a file within a specific date range, you can do that using the After and Before operators, and setting the dates accordingly.

Remember, if you single click on a file, its location is revealed below in the Path Bar. If you are not sure if you have located the correct file single click on it, and then tap the spacebar to preview it.

If you close the Smart Folder a prompt will display asking if you want to save it. If you have located the file you were looking for, there is no need to save the Smart Folder. If you do save it, you will be prompted to name it, and add it to the Sidebar. If you do this, files that meet the criteria, even if you add them in the future, will be displayed in that Smart Folder. In other words, it becomes a saved search.

Everyone who owns a Mac should be aware of Spotlight and Smart Folders and their capabilities because they can make OS X more efficient and enjoyable. Please feel free to comment if you are using Spotlight in other ways, or want to add insight.