Spotlight from the Command Line
mdfindcommand goes beyond
grephacks to create flexible and powerful queries. Surprisingly enough, I couldn't find an
mdfindman page (
mdutilwas there) but the
mdfindcommand worked fine for me in Terminal.
mdfind command goes something like
mdfind Sadun, where Sadun is the search word. To limit the search to a particular folder use the
mdfind -only ~/Desktop Sadun.
mdls command displays the metadata associated with a specified file. e.g.
% mdls Television\ copy.jpg Television copy.jpg -------------
kMDItemAttributeChangeDate = 2006-11-29 11:10:52 -0700 kMDItemBitsPerSample
= 32 kMDItemColorSpace = "RGB" kMDItemContentCreationDate =
2006-11-29 11:10:19 -0700 kMDItemContentModificationDate = 2006-11-29
11:10:19 -0700 kMDItemContentType = "public.jpeg"
kMDItemContentTypeTree = ("public.jpeg", "public.image",
"public.data", "public.item", "public.content") kMDItemCreator
= "Adobe Photoshop CS2 Macintosh" kMDItemDisplayName
= "Television copy.jpg" kMDItemFSContentChangeDate =
2006-11-29 11:10:19 -0700 kMDItemFSCreationDate =
2006-11-29 11:10:19 -0700 (...and so forth...)
It's a great post that goes into far more detail and is well worth a careful read.
Subscribe to Newsletter
Software Updatesmore updates
- Daily App: MyScript Calculator solves your hand-written math equations
- Findery app lets you discover the world around you using annotated notes and maps
- The Learnist app brings its crowd-sourced collection of information to your iPhone
- My cat Cinnamon reviews Friskies Cat Fishing 2
- Photo Grid Collage Maker is capable and free
- iExit gets new features and is now free