LinuxCommandLibrary

gvfs-rename

Rename files or directories using GVFS

SYNOPSIS

gvfs-rename [OPTION...] OLD_URI NEW_URI

PARAMETERS

OLD_URI
    The Uniform Resource Identifier (URI) of the file or directory to be renamed.

NEW_URI
    The Uniform Resource Identifier (URI) for the new name or location of the file or directory.

-h, --help
    Displays a help message with available options.

--version
    Shows the version information of the command.

DESCRIPTION

gvfs-rename is a command-line utility that facilitates renaming files and directories using the gvfs (GNOME Virtual File System) backend. Unlike the standard mv command, which operates primarily on local filesystems, gvfs-rename leverages gvfs to interact with various file system types, including remote ones (e.g., SFTP, SMB, MTP, FTP, WebDAV), as if they were local. This allows users to perform rename operations on files located on network shares or other virtual locations transparently. It's particularly useful in GNOME-based desktop environments, where gvfs provides the underlying abstraction for file management applications like Nautilus. The command takes Uniform Resource Identifiers (URIs) as arguments, enabling it to specify paths on diverse protocols.

CAVEATS

Requires the gvfs daemon and related components to be running and properly configured.

Renaming across different gvfs backends (e.g., from SFTP to SMB) is generally not supported; both URIs must typically refer to the same backend.

Network connectivity is required for remote URIs.

Permissions on the source and destination paths must be adequate for the rename operation to succeed.

URI syntax must be correct for the respective protocol (e.g., sftp://user@host/path, smb://server/share/path, mtp://[device_id]/path).

USAGE WITH URIS

gvfs-rename operates on URIs, not traditional filesystem paths, which is its key distinction. A URI specifies the protocol, host (if applicable), and path. For example, to rename a file on an SFTP server, you might use:

gvfs-rename sftp://user@remotehost/oldname.txt sftp://user@remotehost/newname.txt

Similarly, for a local file, you can use the file:// scheme:

gvfs-rename file:///home/user/oldfile.txt file:///home/user/newfile.txt

However, for local files, the standard mv command is typically more direct and efficient.

COMPARISON WITH MV

While gvfs-rename performs a similar function to mv (renaming), its primary advantage lies in its ability to handle remote and virtual filesystems that mv cannot directly access without prior mounting. mv works on paths resolved by the kernel, whereas gvfs-rename uses the GIO library and gvfs backends to communicate with various protocols. For operations exclusively on local, mounted filesystems, mv remains the conventional and often preferred tool due to its directness and simplicity.

HISTORY

gvfs-rename is a component of the gvfs project, which was developed to replace the older gnome-vfs (GNOME Virtual File System) library. Development on gvfs began around 2005-2006, aiming to provide a more modern, robust, and extensible framework for virtual file system access in the GNOME desktop environment. The shift from gnome-vfs to gvfs brought significant improvements in handling various network protocols and local media, making commands like gvfs-rename essential for performing file operations seamlessly across diverse storage locations. Its usage is tightly integrated with GNOME's file management capabilities.

SEE ALSO

mv(1), gvfs-copy(1), gvfs-trash(1), gvfs-ls(1), gio(1)

Copied to clipboard