终端中是否有任何方法可以列出具有特定颜色标签的所有查找器文件?(即“查找所有带有红色标签的文件”
我知道这在聚光灯下是可能的。寻找一种将其合并到 applescript/terminal 中的方法。
终端中是否有任何方法可以列出具有特定颜色标签的所有查找器文件?(即“查找所有带有红色标签的文件”
我知道这在聚光灯下是可能的。寻找一种将其合并到 applescript/terminal 中的方法。
在终端中,您可以直接使用 mdfind 。它是 Spotlight 的命令行客户端 :)
例如
$ mdfind -onlyin . -literal 'kMDItemFSLabel > 0' # labels have value 50
/cwd/labelled_file.jpg
$ mdfind -onlyin . -literal 'kMDItemFSLabel == 0'
/cwd/all.jpg
/cwd/other.jpg
/cwd/files.jpg
当然,您也可以在 shell 脚本中调用它;)
在 Applescript 中按标签获取文件的 Applescript 代码将是(注意使用整数来定义颜色):
set yellow to 3
tell application "Finder"
files of folder "path:to:folder:" whose label index is yellow
end tell
代码是:
None = 0
Red = 2
Orange = 1
Yellow = 3
Green = 6
Blue = 4
Purple = 5
Gray = 7