Find files by date with mdfind and $time values
mdfind exposes Spotlight's indexed metadata dates such as kMDItemContentModificationDate, and pairs them with handy $time keywords like today, this_week, and this_month.
Run `mdfind 'kMDItemContentModificationDate >= $time.this_week'` to list every indexed file modified in the past week.
01Command
Command
$ mdfind 'kMDItemContentModificationDate >= $time.this_week'
mdfind 'kMDItemContentCreationDate >= $time.yesterday && kMDItemFSName == "*.pdf"'02What it does
Date comparisons use ISO 8601 strings or the built-in $time constants ($time.today, $time.yesterday, $time.this_week, $time.this_month). They compose with other Spotlight predicates using &&, so you can narrow a date range by name or content type in the same query.
03Risk
!Warning: Results depend entirely on Spotlight's index; files in folders excluded from Spotlight (including many dot directories) will never appear.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- mdfind — find files using Spotlight metadataEvidence: Lists kMDItem date attributes and the $time.this_week / $time.yesterday value syntax.
Last verified: 2026-09-17 · Category: Files & Folders