Search 'filename contains' in finder. Help please

Hello. I need to search my filesystem for any files containing the words "foo" (for example). Currently, when I type 'foo' into my finder search bar, it returns only those filenames starting with the word 'foo'. Can anyone tell me the way to adjust search behavior to search filenames containing 'foo' instead of starting with 'foo'?
Thanks!

iMac, Mac OS X (10.5.4)

Posted on Apr 29, 2009 2:36 PM

Reply
8 replies

May 1, 2009 11:10 AM in response to ron1972

The insane default criterion when you bring up a Command-F search is "Kind is Any"--next to Kind you'll see a little pair of triangles, click on it and you'll see Name listed, select that and the Name criterion replaces kind, with the default of "matches" with more little triangles, click to select contains (or begins with, ends with or is). For more information to help you get the most out of Spotlight, see my article here:

http://www.pinkmutant.com/articles/Leopard/leospot.html

Personally, I changed my Keyboard shortcut (in System Prefs->Keyboard and Mouse) so that Command-F brings up a search window with Name contains as the default criterion rather than Kind.
Francine

User uploaded file
Francine
Schwieder

Apr 29, 2009 3:27 PM in response to ron1972

ron1972 wrote:
Hello. I need to search my filesystem for any files containing the words "foo" (for example). Currently, when I type 'foo' into my finder search bar, it returns only those filenames starting with the word 'foo'. Can anyone tell me the way to adjust search behavior to search filenames containing 'foo' instead of starting with 'foo'?
Thanks!

Do not use quotes.
When I enter a keyword and select File Name, I get all instances of file names with the target name anywhere in the filename.
For example if I enter wind
I get all files starting with wind as well as all such files with wind anywhere in them, such as options-distort-wind.png and MacWindowViews.h

Can you give us some specific examples where this fails?

Apr 30, 2009 4:05 PM in response to ron1972

ron1972 wrote:
I am not using quotes. I only get results for filenames that begin with the search term. Is there a way to adjust finder's search behavior? I am using Mac OS X 10.5.6, which might have a different search behavior than its previous versions, if that is why you get different results.
Thanks


I am using 10.5.6 But your profile indicates 10.5.4 and that may be the reason.

However I do notice some curious things that do happen:

If in the Applications directory, I search for band I get GarageBand.app
If I then prepend an e - - eband, I do not get GarageBand.app
If I remove the G and search for and I get a slew of things with and in them, such as ScanAndRead.gif but no GarageBand.

So while I can search for file names that contain a certain word, I do not understand why it seems arbitrary and does not work all the time.

Try what I did and see if you get any similar results.

May 1, 2009 9:45 AM in response to nerowolfe

That's odd: if I open the Applications folder, then do a Command-F search, with the criterion of

"Name contains and"

on the Apps folder, I get 143 results, including things like

GarageBand
GrandPerspective
HandBrake
Random Spheres.bmp
copyLibFile.command
bread and wine
CopyAndPaste.js

And so on. If I add the restriction, "Kind is Applications" I get four results:

GrandPerspective
PandoCalendar
HandBrake
GarageBand

HOWEVER, if I leave the restriction "Kind is Applications" and delete the "Name Contains" criterion, and instead put and in the Search for field I get this bewildering result:

CSSEdit
Xee

Neither seems to have anything to do with my Search for term. Looking at the metadata which is indexed I see both do have the actual word "and" at some point in their metadata. Poking around a bit and thinking, I concluded that the only way to get a partial name search is to use the "Name contains" criterion. If you use the Search box with the only criterion being "Kind is Any" you will get:

1. Any file that has the word "and" in its content
2. Any file whose metadata contains the word "and"
3. A file where "and" is separated in the title by any method that Spotlight recognizes as a delimiter; thus you will get "Roll and Crash" and "Pen And Ink" and "FiveBySevenAndThreeH.txt" but not something like GarageBand.

The delimiters that I know about off-hand are capital letters, spaces, the underscore (thus something like "wash anddry" would show up), and periods (so if a file was named "foo.and.txt" it would show up). There are probably others as well.
Francine

User uploaded file
Francine
Schwieder

May 1, 2009 10:58 AM in response to nerowolfe

Hmm - this is very odd. The file I am searching for is 'invbyyear.txt' I put a copy on my desktop and in documents. I then searched under
'year' - didn't find it
'byyear' - didn't find it
'invby' - found it.

So it clearly (on my system) isn't searching with 'contains' but 'starts with'. Is there anywhere to change the finder search feature?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Search 'filename contains' in finder. Help please

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.