| name | macos-finder |
| description | Advanced Finder operations on macOS including file tags, Quick Look preview, Get Info, and smart folder creation. |
| metadata | {"xiaodazi":{"dependency_level":"builtin","os":["darwin"],"backend_type":"local","user_facing":true}} |
macOS Finder 操作
Finder 高级操作:标签管理、Quick Look、文件信息、智能文件夹。
使用场景
- 用户说「给这些文件打个标签」「预览一下这个文件」
- 用户需要查看文件的详细信息(大小、创建时间等)
- 用户需要按条件筛选文件
命令参考
文件标签(macOS Tags)
tag -a "重要" /path/to/file.pdf
xattr -w com.apple.metadata:_kMDItemUserTags '("重要")' /path/to/file.pdf
mdls -name kMDItemUserTags /path/to/file.pdf
mdfind "kMDItemUserTags == '重要'"
tag -r "重要" /path/to/file.pdf
Quick Look 预览
qlmanage -p /path/to/file.pdf
qlmanage -t /path/to/file.pdf -s 512 -o /tmp/
文件详细信息
mdls /path/to/file.pdf
mdls -name kMDItemDisplayName -name kMDItemFSSize -name kMDItemContentCreationDate -name kMDItemContentModificationDate -name kMDItemKind /path/to/file.pdf
stat -f "大小: %z bytes" /path/to/file.txt
du -sh /path/to/file.txt
file /path/to/file
磁盘空间
df -h /
du -sh .
du -sh */ 2>/dev/null | sort -rh | head -10
最近使用的文件
mdfind "kMDItemFSContentChangeDate >= $time.today(-1)" -onlyin ~ | head -20
mdfind "kMDItemLastUsedDate >= $time.today(-7)" -onlyin ~/Documents | head -20
文件夹统计
find /path/to/dir -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn
find /path/to/dir -type f | wc -l
输出规范
- 文件大小用人类可读格式(KB/MB/GB)
- 时间用「X 天前」「刚刚」等自然语言
- 标签操作后确认结果
- 磁盘空间展示用简洁表格