• 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: mdfind – How to Find a Specific Word?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mdfind – How to Find a Specific Word?


  • Subject: Re: mdfind – How to Find a Specific Word?
  • From: Steve Mills <email@hidden>
  • Date: Tue, 14 Mar 2017 21:02:16 +0000 (GMT)

On Mar 14, 2017, at 03:39 PM, Christopher Stone <email@hidden> wrote:

Hey Folks,

This Spotlight query finds all items whose name contain the string “find”:

cd ~/'Documents/Scripts (Library)/Application Scripting/AppleScriptObjC { ASObjC }'
mdfind -onlyin . 'kMDItemFSName == "*find*"c'

So – all items containing the word “Finder” are also found.

I would like to reduce that to only the items whose names contain the WORD “find”.

Presently the only way I know how to do this is to post-process the mdfind results.

Is there a way to force Spotlight to find what I want?

It doesn't look like it. The Spotlight comparison operators are severely limited to the basic ==, !=, <, etc, but nothing like "contains", nor can it handle full regex syntax. Sad. But, since you're doing a command line thing, you could pipe the output through grep.

Sent from iCloud's ridiculous UI, so, sorry about the formatting

 
 _______________________________________________
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

References: 
 >mdfind – How to Find a Specific Word? (From: Christopher Stone <email@hidden>)

  • Prev by Date: mdfind – How to Find a Specific Word?
  • Next by Date: Re: Run Perl Source Text Directly from AppleScript – List AppleScript Library Handlers
  • Previous by thread: mdfind – How to Find a Specific Word?
  • Next by thread: Re: mdfind ­ How to Find a Specific Word?
  • Index(es):
    • Date
    • Thread