14.9. カスタム GIO メタデータ属性の設定

この手順では、カスタムメタデータ属性を設定する方法を説明します。

特定の gio info 呼び出しと、移動または名前変更後のデータの永続性の違いに注意してください。gio info コマンドの出力に注意してください。

手順

  1. 空のファイルの作成:

    $ touch /tmp/myfile
  2. このファイルのメタデータを表示します。

    $ gio info -a 'metadata::*' /tmp/myfile
    uri: file:///tmp/myfile
    attributes:
  3. このファイルに文字列を設定します。

    $ gio set -t string /tmp/myfile 'metadata::mynote' 'Please remember to delete this file!'
  4. メタデータを表示します。

    $ gio info -a 'metadata::*' /tmp/myfile
    uri: file:///tmp/myfile
    attributes:
      metadata::mynote: Please remember to delete this file!
  5. このファイルを新しい場所に移動します。

    $ gio move /tmp/myfile /tmp/newfile
  6. メタデータを表示します。

    $ gio info -a 'metadata::*' /tmp/newfile
    uri: file:///tmp/newfile
    attributes:
      metadata::mynote: Please remember to delete this file!

メタデータは、GIO API を使用してファイルを移動すると持続します。

関連情報

  • gio の man ページ