Sub topic 8
Editing and refining smart folder criteria
This chapter assumes you can already create and save a smart folder, and that you know how tags are applied and how Spotlight metadata feeds search. Here you change the rules of a smart folder that already exists.
Opening the criteria for editing
A saved smart folder stores its search, not its results. Editing the search changes what the folder shows the next time it updates.
- Click the smart folder in the sidebar, or open it from
~/Library/Saved Searches. - Choose the Action (gear) button in the toolbar, then Show Search Criteria.
- Change the rows that appear under the search field.
- Click Save in the top-right corner of the criteria bar.
If you leave without clicking Save, the changes apply to the current window only. The stored smart folder keeps its old rules.
Changing the rows
Each row has an attribute on the left (such as Kind or Last modified date), an operator, and a value.
- Click the + button to add a row.
- Click the − button on a row to remove it.
- Open the attribute menu and choose Other… to reach more Spotlight attributes, such as Tags or Content Creation Date. Tick In Menu to keep an attribute on the quick list.
- Use the Search scope buttons, such as This Mac or the current folder name, to limit where the search looks.
By default, a file must match every row. This is an "all" rule.
Using any, all, and none
Hold Option and click + to add a compound row. It gives you a pop-up with any, all, and none. Rows nested under it follow that choice.
| Pop-up choice | A file matches when |
|---|---|
| all | It meets every nested row |
| any | It meets at least one nested row |
| none | It meets no nested rows |
For example, to collect files tagged Red or Orange that you changed recently:
- Keep a top-level row: Last modified is within last 7 days.
- Option-click + and set the pop-up to any.
- Under it, add Tags is Red and Tags is Orange.
Testing a rule before you trust it
Try the rule in Terminal first. This confirms the Spotlight attribute behaves the way you expect:
mdfind -onlyin ~/Documents 'kMDItemUserTags == "Red" && kMDItemFSContentChangeDate >= $time.today(-7)'After you save, you can read the stored criteria. Replace the name with your own smart folder:
plutil -p ~/Library/Saved\ Searches/Recent\ Documents.savedSearchThe output lists the query and the search scope. A change you made in Finder should show up there.
Common mistakes
- Forgetting Save. The window shows new results, but the smart folder keeps its old rules.
- Using all when you meant any. Two tag rows under "all" only match files that carry both tags.
- Searching the wrong scope. A folder scope hides matches elsewhere. Switch to This Mac to check.
- Expecting instant results for new tags. Spotlight must index the change first.
Exercise
A smart folder has two top-level rows: Tags is Red, and Tags is Blue. It returns nothing, though you have many files tagged Red and some tagged Blue. What is the likely cause, and how do you fix it?
Show answer
The rows combine under the default "all" rule, so a file must carry both tags. Only files with Red and Blue together match. Option-click + to add a compound row set to "any", move both Tags rows under it, then click Save.