Set custom GIO metadata attribute

GIO (GNOME Integrated Objects) allows applications to attach metadata to the files. You can add and manage your own custom metadata attributes using GIO to determine how applications interact with specific files and provide more detailed information about them.

Procedure

  1. Create an empty file:
    $ touch /tmp/myfile
  2. View the metadata of this file:
    $ gio info -a 'metadata::*' /tmp/myfile
    uri: file:///tmp/myfile
    attributes:
  3. Set a string to this file:
    $ gio set -t string /tmp/myfile 'metadata::mynote' 'Please remember to delete this file!'
  4. View the metadata:
    $ gio info -a 'metadata::*' /tmp/myfile
    uri: file:///tmp/myfile
    attributes:
      metadata::mynote: Please remember to delete this file!

Results

The metadata persists when you move the file by using the GIO API.

For more information about GIO, see the gio man page on your system.