Anyone know the Spotlight query syntax for "only" to limit scope to a folder?

Discussion in 'macOS' started by sclough, May 17, 2010.

  1. sclough macrumors regular

    Joined:
    May 23, 2008
    Location:
    Kansas City, MO
    #1
    I'm trying to see if there is a way in a spotlight query to limit the scope to a particular folder. I have found many of the options such as "kind:app" and "date:today" but I can't find a syntax to limit the search to a folder. If you run the query from the command line using mdfind, you can use the argument onlyin but I can't find an equivalent for the regular query syntax used by the gui.

    I do know how to limit the search using finder, but I'm trying to find the syntax that does this because I'm playing around with using Spotlight as a catalog for Quicksilver.
     
  2. joshellis625 macrumors 6502

    joshellis625

    Joined:
    Feb 16, 2008
    Location:
    Baltimore
    #2
    open the folder you want to search and then use the spotlight box in that folder's window.
     
  3. -aggie- macrumors P6

    -aggie-

    Joined:
    Jun 19, 2009
    Location:
    Where bunnies are welcome.
    #3
    ^^^^
    He wants to do this programatically.


    See this page:

    http://www.macosxhints.com/article.php?story=20071115150413809

    I believe you can use the schema.strings file in:

    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Resources/English.lproj/

    and see this string:

    kMDItemFSNodeCount.Description

    It hasn’t been defined as a user string, so if you add it after line 312 of that file, I would suppose it will work.

    Something like:

    "kMDItemFSNodeCount.Description" = “Folder”;

    and then use the syntax you used for the other searches. You can try it at least.
     

Share This Page