Re: Finding Filenames that contain a certain string
Re: Finding Filenames that contain a certain string
- Subject: Re: Finding Filenames that contain a certain string
- From: Axel Luttgens <email@hidden>
- Date: Wed, 11 Jul 2007 10:18:03 +0200
On 10/07/07 21:14, Luther Fuller wrote:
[...]
So, I tried using 'mdfind' from Terminal just to see what I could
get. I used ...
mdfind -onlyin <path to Jun07DevDocPDF> kMDItemFSName = "bundle"
It did find 7 files whose name contains "bundle", followed by 100s
that do not. (A Spotlight search showed only the first 7 files.)
After trying variants of this command, decided that either 'mdfind'
is badly broken or the man page should be a lot longer.
Yes.
I mean, the man page should be longer. ;-)
Looks like your above command performs an implicit "or": find items for
which string "kMDItemFSName" is relevant, or string "=" is relevant, or
string "bundle" is relevant.
As those individual queries are specified as single strings, they will
explore any attributes of the files, their contents included, not only
their names, and seem to implicitely mean "case insensitive".
Now, according to the man page, a query expression should be passed as a
single shell argument.
So, for searching items whose name is "bundle" one should write
something like this:
mdfind -onlyin <path to Jun07DevDocPDF> 'kMDItemFSName == "bundle"'
The same way, for searching files whose name contains "bundle":
mdfind -onlyin <path to Jun07DevDocPDF> 'kMDItemFSName == "*bundle*"'
or, for a case-insensitive search:
mdfind -onlyin <path to Jun07DevDocPDF> 'kMDItemFSName == "*bundle*"c'
The syntax of query expressions may be found at:
<http://developer.apple.com/documentation/Carbon/Conceptual/SpotlightQuery/SpotlightQuery.pdf>
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden