gvfs-set-attribute
Set file attributes using the GVFS system
SYNOPSIS
gvfs-set-attribute [OPTION...] FILE... ATTRIBUTE [VALUE]
PARAMETERS
FILE...
One or more paths to the files or directories on which to set the attribute. These paths can be local or GVfs URIs (e.g., sftp://user@host/path/to/file).
ATTRIBUTE
The name of the extended attribute to set or remove (e.g., metadata::tag, user::comment).
VALUE
The value to assign to the attribute. If the --remove option is used, this argument is omitted.
--type=TYPE
Specifies the data type of the attribute VALUE. Common types include string, int32, uint32, boolean, byte_array, object. If not specified, string is often assumed.
--value-type=TYPE
An alias for --type.
--remove
Instructs the command to remove the specified ATTRIBUTE from the FILE(s) instead of setting a new value.
-h, --help
Displays a help message and exits.
--version
Shows the version information and exits.
DESCRIPTION
gvfs-set-attribute is a command-line utility used to manage extended attributes on files and directories accessed through the GVfs (GNOME Virtual File System) framework. GVfs provides a unified abstraction layer for accessing various local and remote filesystems (such as FTP, SFTP, SMB, WebDAV, MTP, etc.) as if they were local files. Extended attributes are arbitrary metadata associated with a file or directory, beyond the standard permissions, timestamps, and ownership.
This command allows users to add, modify, or remove these custom attributes, enabling richer metadata management for files stored across diverse storage locations, including those accessed remotely via GVfs backends. It is particularly useful for applications that store custom information alongside files, like tagging, indexing, or content-specific flags.
CAVEATS
Not all GVfs backends or underlying filesystems fully support extended attributes. The ability to set or retrieve attributes depends on the capabilities of the specific backend and the remote server/protocol.
Users must have appropriate write permissions on the file or directory to set or remove attributes. The command may fail silently or with generic errors if the backend does not support the operation or if there are permission issues.
ATTRIBUTE VALUE TYPES
When setting an attribute, it's often crucial to specify its data type using --type or --value-type. This ensures proper interpretation and storage. Common types include:
- string: Textual data.
- int32, uint32: Signed and unsigned 32-bit integers.
- boolean: True/False values (e.g., true or false).
- byte_array: Raw binary data.
- object: A more complex, structured data type, often represented as a serialized object.
HISTORY
gvfs-set-attribute is an integral part of the GVfs project, which was developed as a replacement for the older GnomeVFS in the GNOME desktop environment. Introduced around GNOME 2.22 / 2.24 (circa 2008), GVfs aimed to provide a more robust, scalable, and modular virtual filesystem layer.
This command, along with others like gvfs-info and gvfs-cat, provides command-line access to GVfs functionalities, allowing scripting and management of files across diverse network protocols and local media without direct reliance on graphical interfaces. Its development has mirrored the evolution of GVfs itself, focusing on expanding supported protocols and improving stability.
SEE ALSO
gvfs-info(1), gvfs-cat(1), gvfs-mount(1), xattr(1)