Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sclough

macrumors regular
Original poster
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.
 
^^^^
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.