• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finding Filenames that contain a certain string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Finding Filenames that contain a certain string
      • From: Luther Fuller <email@hidden>
References: 
 >Finding Filenames that contain a certain string (From: David Bradley <email@hidden>)
 >Re: Finding Filenames that contain a certain string (From: "Mark J. Reed" <email@hidden>)
 >Re: Finding Filenames that contain a certain string (From: Nick Hearn <email@hidden>)
 >Re: Finding Filenames that contain a certain string (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Referencing the Print window in InDesign
  • Next by Date: InDesign CS2: Problem with launching scripts out of the script window
  • Previous by thread: Re: Finding Filenames that contain a certain string
  • Next by thread: Re: Finding Filenames that contain a certain string
  • Index(es):
    • Date
    • Thread