Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Limit Spotlight searches to filenames only System 10.4
Tiger only hintI have seen a number of hints about limiting Spotlight search results to filenames only.

If you want to use Spotlight to find a file or directory that has abc in its name, simply type "abc" (including the quotes) in the Spotlight search box (Command-Space), and your search will be limited to file or directory names only.

[robg adds: I was pretty sure we had already run something along these lines, but I couldn't find it when looking through all the Spotlight hints, so here it is -- please let me know if you do find it to be a duplicate. This handy trick will not work for Finder searches, only Spotlight menu searches, so you'll have to use some of the other hints to change the Command-F behavior.]
    •    
  • Currently 4.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[17,722 views]  

10.4: Limit Spotlight searches to filenames only | 14 comments | Create New Account
Click here to return to the '10.4: Limit Spotlight searches to filenames only' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Limit Spotlight searches to filenames only
Authored by: rhowell on Jul 20, '05 10:17:18AM

Interestingly, this search will include the titles of my PDF documents, and not just the filenames.

For example, I use a plotting program to create PDF plots of data, and it gives the PDF plot a title equal to the saved plotting file. In Spotlight, here's the info returned for a PDF plot:

Document Name: plot.pdf
Where: /Users/rhowell/Desktop
Title: /Volumes/data/run/feff/a2.48.agr

This after I searched for "feff". The name of the file returned is "plot.pdf".



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: sjonke on Jul 20, '05 10:26:54AM

See my comment above - this trick is a keyword and name search, not strictly a name-only search. You can see the keywords for an item by using the command "mdls" at the terminal. Ex:

mdls /path/to/some.file

One of the keywords for that file undoubtably has your search string in it. Indeed it's very likely that Keynote files get the "Title" as a keyword.

---
--- What?



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: sjonke on Jul 20, '05 10:28:22AM

Err... I read Keynote when you said PDF. Oops. Anyway, you'll probably find the search string among the keywords for the file

---
--- What?



[ Reply to This | # ]
Does work in Finder, but has limitations
Authored by: sjonke on Jul 20, '05 10:22:08AM

Actually it does work in the Finder too. However, one thing you need to know about this trick is that it will only reliably find whole words. It may or may not find partial words. So, for example, the search string "Test" (with the quotes) will find Test.zip but may or may not find Testing.zip. Why it is problematic this way I don't now - hopefully it's a bug that will be fixed. Also, this is not strictly a name-only search. Actually it is a keyword and name search. If a file has a keyword with that word in it, even though the name does not, it will find that item too.

---
--- What?



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: hmelman on Jul 20, '05 12:21:03PM

This works oddly for me. Yesterday I created a text file with emacs called "WikiBookConf.txt". If search in spotlight for wiki (no quotes) it shows up and is the top pick. So it's been indexed. If I search for "Wiki" (with quotes) it does not appear. If I search for "WikiBook" (with quotes) it does not appear. If I search for "WikiBookConf" (with quotes) it does. I get the same results if I use all lowercase. Anyone have any ideas?



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: fud on Jul 20, '05 01:21:21PM

The best way I have found to do pure name searches is to use Find in the Finder, and pick Name in the popup. Then type "wiki", pick a 2nd Name popup and type "book". This will find: Wikibook, Wiki Book, wikibookie, etc. This is the same type of search Panther supported.



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: hmelman on Jul 20, '05 09:30:43PM

Well yes, explicitly limiting the search to names will do it. But if others get name only search from using quotes in spotlight why can't I? Do quotes only work in some cases? Do I have some setting incorrect? (I'm using 10.4.2). My best guess is that quotes aren't searching the filename but some metadata that's set by most programs but not aquamacs. How would I check that hypothesis? Note, I tried this on an excel file I created and had similar problems.



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: SeanAhern on Aug 07, '05 03:26:19PM

It's not matching substrings, only whole words.



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: hypert on Jul 20, '05 02:18:34PM
Rob, you are thinking of this hint, where the quotes "trick" was mentioned in one of the comments.

This searches for more than just the filename, though, as I mentioned in that hint, too. Looks like the term I was using was in the Word Title property, though, so the quotes do seem to restrict the search to filename and keywords (including Word properties), and seem to ignore content.

[ Reply to This | # ]

Quotes do not limit to filenames only
Authored by: hargreae on Jul 20, '05 07:51:33PM

I ran a search for "San Diego" via the Spotlight menu and one of the results was a file named "LEGOLAND California Directions.html"

Obviously, the phrase "San Diego" was in the content of this html file, which is why it showed up in the results.



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: elmimmo on Jul 21, '05 08:04:30AM

Arg, gosh, do I hate Spotlight. The concept is nice, the implementation, pathetic. Everytime I learn a new "trick" I find another place where Spotlight is broken: I have PLENTY of numbered folders called "Unidad 2", "Unidad 3", "Unidad 4" and so on.

Can somebody explain my WHY typing, with quotes, "Unid" or "Unida" finds NONE, while "Unidad" returns all of them? I even get some files that do not have the string in the filename and that have no keyword assigned for all three strings, just different, also seemingly unrelated, ones that non-quoted searches insists in returning… and I am indeed talking about Spotlight, not the Finder's search (and why those are two different things, beats me).

I think someone had quite a hard time in figuring a broken algorithm for searching inside words. Because I cannot think of an easy one that would behave like Spotlight does in this case. Has someone at Apple ever used this P.O.S.?



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: sjonke on Jul 21, '05 09:01:11AM

As I said below, currently this trick only reliably finds whole words. Apple doesn't advertise this feature, and this is no doubt why. I don't think you'll find any documentation anywhere saying you can do it. It might even just be a fluke that it behaves the way that it does. Some artifact of the search engine.

---
--- What?



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: kmacdonald on Jul 23, '05 02:45:51PM

I think the key here is that Spotlight starts searching as soon as you start typing. So, if you want to find all files with the words "test" and "tested" and "tester" for example, type "test

This open-ended search seems to recognize by the first quotation mark that you want to only search file names. This issue has been driving me up the wall but since I tried the open ended quote it's worked fine. I just discovered this today so I haven't given it a real thorough testing but so far so good!



[ Reply to This | # ]
10.4: Limit Spotlight searches to filenames only
Authored by: fud on Jul 21, '05 01:53:29PM

I agree Spotlight is a full word search only [reminds me of the Newton]. I keep wondering if there isn't a key combination that forces a search of the metadata absolutely [not word delimited].

Also, putting quotes around the search seems to search the metadata that is the file properties but not content [still full words].

I use the Name and Contains popups a lot, because I know part of a word that is in the file name [or words with 2 or more Name searchs at once]. At least Name search is indexed with Spotlight in Tiger, so it's much faster than Panther.

I have a saved Find that has the standard Spotlight Search line, then 2 more lines with the popups set to Name and Contains. Then I use Launchbar to quickly access this search.

I wish standard keyboard shorcuts would work in the Find window in the Finder [running 10.4.2]: Tab doesn't seem to move between typing fields, no shortcuts for popups, and CMD-D doesn't work for "Don't Save" buttons when closing a saved search.



[ Reply to This | # ]