Level: Switcher / Basic to intermediate
Spotlight is Mac OS X's powerful local, index-based search engine. On a new installation of Mac OS X, Spotlight performs an initial scan of all the files on the drive, then tracks all changes, recording not only file names and locations, but also the contents of many types of files and a large number of additional criteria based on a file's contents, attributes and metadata. How to access these criteria is the most important power tip in this week's post. Although independent of previous installments, you will certainly benefit from the previous post about Spotlight, which included basic tips on using both the Menu bar and Finder window. This post looks specifically at the Finder window type of Spotlight search.
Tips are marked with a ✪
Finder window Spotlight is the full deal - the place where you see all your search results and finely tune what is displayed. I covered the basics last week, but this time, I'll show you more advanced usage.We will make some small changes to target our results more easily. While in the Finder type ⌘, (cmd comma) or go to the Finder menu (near ) and choose Preferences.
✪ Add your user (home) folder to the Sidebar:
In the Sidebar tab, click the checkbox at the bottom of FAVORITES.
✪ In the Advanced tab, change the "When performing a search" setting to "Search the Current Folder".
✪ Since most of your files have a period (full-stop) character followed by the file extension (.doc, .jpg etc) we can use this to kick off an exhaustive Spotlight search, which finds all your files.
This is a good way to start a generic search with the intention of saving it later:
- Switch to the Finder
- Type ⌘n to open a new Finder window
- Click on your user (aka home) folder in the Sidebar - the one we just added. Usually it has your name on it.
- Type a period into the search field. Ignore or select the small "Name matches: ." choice - it refers to searching the contents of files or filenames only.
Type ⌘j or go to the View menu - View Options and customize your search window as you would a normal folder view. By customizing a search, it serves as a different perspective on your files - one other than the traditional "files in folders" view that is seen when browsing Finder windows.
✪ Criteria and Attributes
This is the part where Finder window Spotlight really shines.
Click the plus (+) sign next to the Save button. This brings up additional criteria with which we can narrow the search.
You will see two buttons: Kind and Any. The first, Kind, is the criteria (the kind of file we are searching for). The second button, Any, is an attribute of the criteria, in this case, any file.
In practice you will find honing down your searches pretty intuitive. The advanced options are neatly tucked away in these drop-down menu buttons.
Let's say, for example, you want to find all images — you will change the buttons to read: Kind: Image and Any: All.
Once you have chosen criteria, you may remove the period (full-stop) from the search pane.
You can add additional criteria by clicking the (+) again as often as you need. This is useful for, say, finding files created within a very specific range of dates. Set one criterion to "Created date" is "before" and another to "Created date" is "after".
Hold down ⌥ (option aka alt) and the (+) will change to (...) - click it. Now you can select "none" with criteria to exclude items from your search results.
✪ Even more criteria
Choosing "Other.." from the first (Kind) criteria menu button brings up an additional ±140 items to optionally add to that list, like the one at right. The full list is here.
People who rely heavily on email can add "Attachment Names" or "Attachment Types" to the list; photographers and publishers can add "Pixel Width" and "Pixel Height" to search for specific widths of pics; music professionals can search for "Tempo" in sound files measured in BPMs. Programmers and tech support personnel may consider turning on "File Extension", "File Visibility" and "System Files".
Not only is the list detailed and exhaustive, but some applications (such as FontExplorerX) add their own items to the list too. To see the full list on your particular Mac:
- type ⌘ spacebar to bring up Spotlight
- type "terminal"
- hit enter
- copy/paste or type: mdimport -A
- hit enter
Save searches that you think you may use frequently with the "Save" button and add it to your Sidebar, for example "All Pictures". You may add criteria as usual after clicking the sidebar icon. Right-clicking on a saved search in the Sidebar lets you "Show Search Criteria".
Once in a blue moon you will need old-fashioned non-indexed search, for example: remote volumes which have not been indexed yet; or hard drives with unusual permissions. Try free EasyFind or Find any file (free and $6 shareware versions) - both excellent.
Bonus tip for Snow Leopard users: Enable folder sizes in searches
For an unspecified reason, folder sizes are not visible by default when searching in Mac OS X 10.6 Snow Leopard. It is possible and safe, though a little tricky, to enable this feature. You will also need a special tool for this: Pref Setter. It's free, but consider making a donation to the developer. Download, unzip and drop it into Applications (in your Sidebar).
- Start a search in a Finder window
- Type ⌘j to bring up View Options
- Enable any one of the columns under "Show Columns" eg. "Label". Close both windows.
- Highlight and copy (⌘c) the following: ~/Library/Preferences/com.apple.finder.plist
- Type ⌘⇧g (cmd shift g) to "go to folder"
- Paste (⌘v) the line we just copied. Hit enter
- Open the file with Pref Setter
- Scroll down to SearchViewSettings | ListViewSettings | Columns | Size
- Change "Visible" to True
- Save and quit Pref Setter
Sometimes the Finder overwrites the file while you trying to modify it so it doesn't always work the first time. Try again.
Have you found other things you want to do in Spotlight? Let us know what they are in the Comments below.
Simon Barnett is a freelance tech consultant / support specialist, creative publisher, and Mac software (registered dev programme) and web developer in Cape Town, South Africa. In addition, he has had several years experience in designing and training courses in computer and software usage to beginners and professionals. He freelances as iSimon. Apples and Macs have been his primary platform since 1982.