Tidy and find
How to find files on a Mac by date, size, type or text inside
Spotlight, Finder search criteria and mdfind in Terminal can all find a file you half remember. Here is how to use each, and how Orrel turns a plain sentence into the same filters.
You rarely remember a file's name. You remember that it was a PDF, that it arrived last week, that it was large, or that it mentioned a particular word. macOS can search on all of those; the trick is knowing where each kind of search lives.
Spotlight
Press ⌘Space and type. Spotlight matches names and the text inside documents it has indexed. Two additions make it far more precise:
- kind: narrows by type.
kind:pdf leasefinds PDFs mentioning a lease;kind:image,kind:folderandkind:presentationwork the same way. - Show more in Finder. Scroll to the bottom of the results and choose to search in Finder, which gives you every match and the criteria below.
Finder search with criteria
In a Finder window press ⌘F. Choose This Mac or the current folder at the top, then click + to add rows:
- Kind is PDF, Image, Movie, Archive and so on.
- Last opened date, Created date or Last modified date is within the last 7 days, or after a specific date.
- Other… opens a long list of attributes. Tick File Size, Contents or Where from to make them available as rows.
Hold ⌥ and click + to add an Any or None group, which is how you search for "PDFs or Word documents". Click Save to keep the search as a Smart Folder.
mdfind in Terminal
Terminal's mdfind asks the same Spotlight index and is exact about what it asks. A few useful forms:
# Words anywhere in names or contents
mdfind "wifi password"
# PDFs over 5 MB changed in the last 7 days
mdfind 'kMDItemContentType == "com.adobe.pdf" && kMDItemFSSize > 5000000 && kMDItemContentModificationDate >= $time.today(-7)'
# Anything downloaded from GitHub
mdfind 'kMDItemWhereFroms == "*github.com*"'
# Limit to one folder
mdfind -onlyin ~/Downloads "invoice"
It is fast and scriptable, and the attribute names take some looking up. Run mdls on a file to see every attribute Spotlight holds for it.
How Orrel does it
Orrel's search box takes a sentence and turns it into filters you can see. pdfs from last week over 5 mb becomes three chips, Kind: PDF, Modified: last week, Size: over 5 MB, and the results update as you type. You can remove a chip if it guessed wrong. Some other forms it understands:
- Where a file came from. zips from github uses the download source macOS records for each file.
- Text in screenshots. screenshots with wifi finds the one showing the password, because Orrel reads the text in screenshots and images on your desktop and in Downloads with Apple Vision.
- From any app. ⇧⌘Space opens quick search on top of whatever you are doing.
Results show where each file lives, with Show in Finder one click away. Searches can be saved, and Find Files is available as a Shortcuts action.
Where Orrel stops
Orrel reads the Spotlight index, so it finds what Spotlight has indexed in your home folder and Applications and nothing more. It leaves out ~/Library, hidden folders and developer clutter such as node_modules. External drives are not part of its library. The sentence parser handles the common ways of describing kinds, sizes, dates and sources, not every sentence you might type; when it does not understand a word, it searches for it as text. Text in images is read only for the desktop and Downloads, not your whole photo library.
Questions
Why can't Spotlight find a file I know is there?
Usually because the folder is excluded or not yet indexed. Check System Settings › Spotlight (or Siri & Spotlight on older versions) for the Search Privacy list, and give a new drive a little while to index. Files inside ~/Library and hidden folders are not shown in normal searches.
Does Spotlight search the text inside PDFs?
Yes, for PDFs that contain real text. Scanned PDFs that are only images have no text for Spotlight to index unless something has run text recognition on them.
Does Orrel build its own index?
No. Orrel asks the Spotlight index that macOS already keeps. The only text it reads itself is in screenshots and images on the desktop and in Downloads, which it recognises on your Mac and caches so those become searchable too.