How can I make Spotlight search part of a file name?

Discussion in 'macOS' started by thomasp, Sep 22, 2005.

  1. thomasp macrumors 6502a

    Joined:
    Sep 18, 2004
    Location:
    UK
    #1
    Hi,

    I'm running OSX 10.4.2. I have a few thousand image files on my three HD's (on a Dual G4 - two internal, one external) and often need to find these image files by their filenames.

    The trouble is, there are two possible starts to the filename, either "BC6V..." or "CRW_...", and the files can end in either .tif or .jpg.

    If I just type in the number part of the filename (which follows the prefix), Spotlight refuses to find the file. The only way I can get Spotlight to find the file is to guess what the prefix was.

    Sherlock in OS9 and Find in older versions of OSX used to match a string to filenames without a problem - why can't Spotlight?


    Is there any way I can make spotlight search for the string of 4 numbers in the filename, and thus make it return useful results?


    Sorry if I'm not being very clear, it's a little tricky to explain :)
     
  2. snkTab macrumors 6502a

    snkTab

    Joined:
    Nov 13, 2004
    Location:
    Cincinnati, OH
    #2
    Hrmm.....

    I have files that use the '.' as the delimited

    abc.123.defg

    and if I tell spotlight to search '123', it picks it up just fine. move the file to your primary drive and see if it works on it. i wonder if spotlight indexs other drives.
     
  3. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #3
    No solution, but I can confirm the original problem....

    I have files that start with dates in the filename, written in this format:

    20050922 - rest of filename.ext

    200509 will find all files with dates 200509xx but 0922 will not find files with 20050922 in the filename....
     
  4. thomasp thread starter macrumors 6502a

    Joined:
    Sep 18, 2004
    Location:
    UK
    #4
    Yes Spotlight does index the other two drives just fine.

    Basically, like mkrishnan, if I wanted to find an image with the number string 1836 in it, the file could be called any of the following:
    BC6V1836.jpg
    BC6V1836.tif
    CRW_1836.jpg
    CRW_1836.tif

    It's a bit annoying to have to put in the beggining of each filename, when you don't know it.


    I'm surprised there isn't a plugin out there in PlugIn Land that fixes this.
     
  5. skunk macrumors G4

    skunk

    Joined:
    Jun 29, 2002
    Location:
    Republic of Ukistan
    #5
    I've noticed this, too. Bloody annoying, and really unnecessary. Why on earth should you have to enter the first letter/number? It's not even consistent: if I search for "photo", it'll find "Photoshop" and "iPhoto", but if I search for "hoto", it won't find either. What's that about?
    :confused:
     
  6. lexfuzo macrumors 6502

    Joined:
    Mar 15, 2005
    Location:
    The heart of Europe
    #6
    Can't you use wildcards in spotlight?

    like "*1836*"
    :confused:
     
  7. thomasp thread starter macrumors 6502a

    Joined:
    Sep 18, 2004
    Location:
    UK
    #7
    Doesn't seem so :(

    There seems to be no pattern to Spotlight's searching.
     
  8. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #8
    The strange thing is, according to Apple's documentation, the underlying programs that drive Spotlight *are* able to take this kind of wildcard; Spotlight as used from Finder cannot, AFAIK.
     
  9. Mindcrime macrumors regular

    Mindcrime

    Joined:
    Oct 24, 2003
    Location:
    Houston, Texas
    #9
    Quick and Easy Way:
    Do Cmd + F in a Finder Window, then under the search parameters, select Name > Contains > and Kind > Images.

    [​IMG]

    Code Happy Way:
    If you do Cmd + F in a Finder Window, then under the search parameters, select Raw Query (open the Kind menu, then select Other... then choose Raw Query from the dialogue box), you'll have much more flexibility in searching for wildcard modified terms.

    For example, in the Raw Query field you can put:

    Code:
    (kMDItemFSName == "*1234*")
    
    and your search will be limited to files with that sequence of numbers in the filename. You can further refine it by adding a second parameter on the same line, such as:

    Code:
    (kMDItemFSName == "*1234*") && (kMDItemFSName == "*.jpg")
    
    Once you get the results you're after, save this as a Smart Search for future use. Everytime you open the Smart Search file, it'll display an up-to-date list of files matching that criteria.

    [​IMG]

    Menu-bar Spotlight isn't setup for partial name searching (where the text for which you're looking is embedded in the file name, not starting it off.)
     
  10. thomasp thread starter macrumors 6502a

    Joined:
    Sep 18, 2004
    Location:
    UK
    #10
    Thanks for the great tip, Mindcrime :) That should make my life easier :D
     

Share This Page