[Tiger 分享] Spotlight 相關 shell 指令

Mac OS X 平台上程式設計的相關問題討論

版主: bryanchangdigdog謝孟叡

回覆文章
內容
發表人
留言五百如一日
文章: 610
註冊時間: 12/25/2001 1:01 am

[Tiger 分享] Spotlight 相關 shell 指令

#1 文章 »

在 /usr/bin 內有數個 shell 指令,對應了 Spotlight 的功能:

/usr/bin/mdcheckschema
/usr/bin/mdfind
/usr/bin/mdimport
/usr/bin/mdls
/usr/bin/mdutil


:lol: 例,查看 volume 的 indexing status:

代碼: 選擇全部

$ sudo mdutil -s /Volumes/bee

/Volumes/bee:
Status: Indexing Enabled


:lol: 例,查看檔案或資料夾的 metadata:

代碼: 選擇全部

$ mdls ~/.bash_profile

.bash_profile -------------
kMDItemAttributeChangeDate = 2005-05-02 18:15:13 +0800
kMDItemFSContentChangeDate = 2005-04-29 23:14:53 +0800
kMDItemFSCreationDate = 2005-04-29 23:14:53 +0800
kMDItemFSCreatorCode = 0
kMDItemFSFinderFlags = 0
kMDItemFSInvisible = 0
kMDItemFSLabel = 0
kMDItemFSName = ".bash_profile"
kMDItemFSNodeCount = 0
kMDItemFSOwnerGroupID = 501
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 19
kMDItemFSTypeCode = 0
kMDItemID = 199803
kMDItemLastUsedDate = 2005-04-29 23:14:53 +0800
kMDItemUsedDates = (2005-04-29 23:14:53 +0800)



:lol: 例,詳列可搜尋的屬性:

代碼: 選擇全部

$ mdimport -A

:lol: 例,查看不同類型的檔案有什麼可搜尋的屬性:

代碼: 選擇全部

$ mdimport -X

:lol: 例,搜尋 64 pixel 闊的檔案:

代碼: 選擇全部

$ mdfind 'kMDItemPixelWidth = 64'

/Users/bill/Sites/triste/images/skull.jpg
fayever
嗜冰客
文章: 1586
註冊時間: 11/04/2004 11:45 pm
來自: 一堆台巴子的鬼島

#2 文章 fayever »

一個字也看不懂...
真的很悲Orz
頭像
bryanchang
討論區管理員
文章: 7057
註冊時間: 04/19/2001 1:01 am
來自: The '60s
聯繫:

#3 文章 bryanchang »

多謝悲兄的分享,Mac Geekery 還有相關的介紹:

http://www.macgeekery.com/tips/how_to_e ... the_finder
圖檔
回覆文章