Name

mdfind

Synopsis

mdfind [-live] [-onlyin directory] query

Searches the Spotlight metadata for items matching query, and returns a list of files for further manipulation.

Options

-0

Displays each entry followed by a null character instead of a linefeed. This is usually used for feeding into xargs -0.

-live

After displaying the list of files, displays a count of files matching the query. The count is updated each time the count is updated. Use Control-C to cancel.

-onlyin dir

Limit the directories searched to dir.

Common attributes

The following are attributes commonly set by the metadata indexer. These attributes are also used by the mdls command. You can use mdimport -A to list all attributes supported by indexers in your system.

kMDItemAttributeChangeDate

The date and time that a metadata attribute was last changed.

kMDItemAudiences

The intended audience of the file.

kMDItemAuthors

The authors of the document.

kMDItemCity

The document’s city of origin.

kMDItemComment

Comments regarding the document.

kMDItemContactKeywords

A list of contacts associated with the document.

kMDItemContentCreationDate

The document’s creation date.

kMDItemContentModificationDate

Last modification date of the document.

kMDItemContentType

The qualified content type of the document, such as com.adobe.pdf for PDF files and com.apple.protected-mpeg-4-audio for an Apple Advanced Audio Coding (AAC) files.

kMDItemContributors

Contributors to this document.

kMDItemCopyright

The copyright owner.

kMDItemCountry ...

Get Mac OS X Tiger in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.