Show Table of Contents
15.9. 使用 GVFS 元数据
“
GVFS”将元数据存成一组与特定文件绑定的简单键值/值对信息。因此,用户或应用程序可以使用工具保存一些小数据,它们是为运行时间信息设计的,例如图标位置,最后使用位置,文档、徽标、笔记中的位置等等。
一旦移动文件或目录,相应的元数据也会移动,以保证它和对应文件保持联系。“
GVFS”私下存储所有元数据,以便它仅在该计算机上可用。但是也会追踪“GVFS”装载和可移动媒体。
注意
可移动媒体现在安装在
/run/media/ 目录下,而非 /media 目录下。
如需查看和操作元数据,您可以使用:
gvfs-info命令;gvfs-set-attribute命令;- 或其它任何处理属性的本机 GIO 方式。
下例对某个自定义元数据属性进行了设置。请注意在移动或重命名之后,特定的
gvfs-info 调用与数据持久性之间的差异(注意 gvfs-info 命令的输出):
例 15.5. 设置自定义的元数据属性
$ touch /tmp/myfile $ gvfs-info -a 'metadata::*' /tmp/myfile attributes: $ gvfs-set-attribute -t string /tmp/myfile 'metadata::mynote' 'Please remember to delete this file!' $ gvfs-info -a 'metadata::*' /tmp/myfile attributes: metadata::mynote: Please remember to delete this file! $ gvfs-move /tmp/myfile /tmp/newfile $ gvfs-info -a 'metadata::*' /tmp/newfile attributes: metadata::mynote: Please remember to delete this file!

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.