Files in Downloads you never opened: finding them with Spotlight's last-used date
Spotlight stores a "last used" date for files you open, and <code>mdfind</code> can list the files that never got one. That sounds like the perfect way to find forgotten downloads. We tested it on a real Mac (macOS 27.0.1, 13 to 14 November 2026) and it works, with one big catch: the date is only set by some ways of opening a file. Here is what we measured, the one-line command, and how to use it without deleting something you did use.
The two dates Spotlight keeps
| Attribute | What it means | How to read it |
|---|---|---|
kMDItemDateAdded | When the file arrived in that folder | mdls -name kMDItemDateAdded file |
kMDItemLastUsedDate | Last time a Mac app opened it through the system (null if never) | mdls -name kMDItemLastUsedDate file |
kMDItemWhereFroms | The web address a browser download came from | mdls -name kMDItemWhereFroms file |
Files you made yourself, or copied in, also get a date added, but a browser download carries a "where from" too. That one is handy later: it tells you where to re-download a file you remove.
Our test: what sets the last-used date
We created six identical 0.4 MB text files in a scratch folder in Downloads, waited for Spotlight to index them, then opened each in a different way. We checked the date 25 seconds later.
| File | What we did | Last-used date after |
|---|---|---|
| a-untouched.txt | Nothing | null |
| b-cat.txt | cat file > /dev/null | null |
| c-open.txt | open file (default app, like a double-click) | set (19:33:46 UTC) |
| d-openTextEdit.txt | open -a TextEdit file | set (19:33:49 UTC) |
| e-quicklook.txt | Quick Look preview (qlmanage -p) for 4 seconds | null |
| f-dd-read.txt | dd read of the whole file | null |
So the date means "opened by an app through macOS", not "read by anything". Reading, copying, a Quick Look peek and Terminal tools leave it empty. A file you only ever previewed with the space bar still looks never opened. (The use count attribute read 4 on both opened files after one open each, so don't treat it as a count of your visits.)
How common is the date on a real Mac?
We counted what Spotlight knows about the home folder of the Mac we tested on:
| Query (home folder) | Count |
|---|---|
| Files and other non-folder items | 647,363 |
| ...with a last-used date | 24 (0.004%) |
| Apps in /Applications | 21 |
| ...of them with a last-used date | 9 |
| Files in Downloads (6 real ones, excluding our test folder) | 0 with a date |
Most of that home folder is code and caches, which nobody "opens" through macOS, so the tiny share is not a surprise. For Downloads it matters, though: all six real files there, a 256 MB disk image, a 173 MB zip, a PDF and three small certificate and key files, show no last-used date. Downloaded on 13 October, 9 November and 18 October, they might have been used from Terminal or Xcode, or not at all. The date alone can't tell you which.
The command
This lists everything in Downloads with no last-used date, biggest first, with its modified date. It only reads.
On our Downloads folder it printed:
Variations that worked in our test:
- Used lately:
kMDItemLastUsedDate >= $time.today(-30) - Over 1 MB and added more than 30 days ago:
! kMDItemLastUsedDate == "*" && kMDItemDateAdded < $time.today(-30) && kMDItemFSSize > 1000000 - Count only: add
-count
Two details we had to fix on the way: the "not set" test is <code>! kMDItemLastUsedDate == "*"</code> (a plain comparison with null returns nothing), and filtering with <code>kMDItemKind != "Folder"</code> still let folders through, so use the content type <code>public.folder</code> instead.
Before you delete anything from the list
- A never-opened file can still matter. A signing certificate, an API key file or a license PDF is opened by a tool, not an app, so it has no date. Our list has three of those. Look at what each is first.
- Check "where from". If
kMDItemWhereFromsshows a normal download address you can fetch again, it is cheap to remove. If it is empty, nobody can get it back for you. - Look at the date added. A 270 MB installer from this week may be one you haven't got to yet.
- Use the Trash, not
rm. Move reviewed files to the Trash and give it a week before you empty it.
Where the date can mislead you
- Files opened from Terminal, scripts, Xcode or a build tool stay "never opened".
- Files opened before Spotlight indexed the folder, or on a drive Spotlight doesn't index, can show nothing.
- A file moved in from another Mac may carry the date its other Mac recorded, or none.
- An external drive with Spotlight off gives no answer at all; use modified dates there.
For a general order of what to review first, see <a href="/articles/safe-files-to-clean-up-mac-windows-linux">safe files to clean up</a>.
Zofle, our free Mac app, lists big old files in Downloads and elsewhere so you can review them by size and age, and move them to the Trash with an undo.
Download Zofle for MacSources
- Our own tests on macOS 27.0.1, 13 to 14 November 2026: six scratch files opened six ways, and read-only
mdfindcounts over one home folder. - Apple,
mdfindandmdlsman pages on macOS (query syntax and the$timevariables).
Zofle Pro news
People signing up now will get Zofle Pro, with more features, for free when we launch it.