12

I'm used to using the search window in Windows that provided the ability to use options such as:

  • Date of Creation/Modification
  • File Size
  • File Extension
  • Wild Card Characters

How can I search with Spotlight with similar criteria?

8

This article has a lot of good information on maximising the power of Spotlight search. To search by date, for example:

Check the Date Looking for a file that was created during a specific time period? Spotlight has a handle on dates. Typing date:today will bring up files you created, read, received, or opened today. You can also use the date: keyword with yesterday and tomorrow (for the latter, Spotlight restricts its results to iCal events and to-do items).

The latest version of Spotlight also lets you specify more parameters (whether a file was created or modified on a certain date), as well as enter an exact date or a range of dates. For example, you can type created:12/25/07 to find files authored on that date; type modified:<11/30/06 to look for files changed before that date; or type created:1/1/06-12/31/06 to locate files created between these two dates. Unfortunately, date: keywords don’t seem to work correctly all the time.

  • Adding to all that, you can also use Command + Option + Space to open the "Searching" window (or select "Show All" on the regular search area) in which you can press the + button to add filters. – cregox Apr 23 '10 at 20:34
  • i wish there was a quick way to specify a search in a folder. ie "myclientfolder/: invoice 001" – v3nt May 25 '16 at 10:23
  • This answer was posted in 2009. It's 2018. Is it possible to do wild card searches yet? I have cat1.png, cat2.png. Spotlight search for cat*.png shows no results :( – 1.21 gigawatts Nov 11 '18 at 23:47
8

Unfortunately it seems you can only do wildcard queries using "raw queries" which are typically associated with the mdfind command. For example (the c at the end makes it case-independent):

mdfind "kMDItemDisplayName=='*back*'c"

While you can't do Raw Queries from the simple Spotlight fields (menubar and upper right in Finder), you can use Raw Queries from Finder advanced search (aka Spotlight window). Jump to finder search in Finder using Command-F (or use the global shortcut Command-Option-Space). Then change the Kind to "Others > Raw Query":
Raw Query example

You can then click Save to add it as a Smart Folder in the Sidebar. To skip the Others and get to Raw Queries a little faster you can add Raw Query to the Kind drop-down menu: Adding Raw Query to menu

A little more info on mdfind and wildcards is at https://web.archive.org/web/20160307180844/http://www.macdevcenter.com/pub/a/mac/2006/01/04/mdfind.html?page=3. Also see this great superuser blog post by @slhck at Digging Deeper: Mastering Spotlight in OS X. The different attribute keys you can use is at Apple MDItemRef.

1

The Finder provides you with multiple options to constrain the search: (in 10.4) just select File>>Find... from the Finder's menu and click on the (+) button to get more options like the size, the kind of the file, or when it was last opened.

0

Follow up to studgeek's reply, one can use following command line functions to quickly find and open relevant file. I find this easier than typing long string of query in spotlight window.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.