Re: mdfind – How to Find a Specific Word?
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