gvfs-monitor-file
Monitor a file for changes
SYNOPSIS
gvfs-monitor-file [OPTIONS] FILE
PARAMETERS
FILE
Path to the file or directory to monitor.
--nofollow
Don't follow symlinks.
--verbose
Be verbose: prints events to standard output in human readable format.
--help
Show help options.
DESCRIPTION
The gvfs-monitor-file
command is a utility that monitors a specific file or directory for changes using the GVfs (GNOME Virtual File System) framework. It provides real-time notifications whenever the file is modified, deleted, created, or its attributes change. This command is useful for scripting and automation, allowing applications to react dynamically to file system events without continuously polling the file. GVfs is particularly useful for interacting with remote filesystems (like SMB, SFTP, or WebDAV) as it provides a consistent interface for monitoring changes even across different protocols. Monitoring the file on a remote filesystem will be handled by GVfs and will not create extra traffic by polling the file.
OUTPUT FORMAT
By default, without the --verbose
option, gvfs-monitor-file
will print to standard output only a simple message when a change happens, making it suitable for scripting.
When used with --verbose
, the output is formatted for human readability, providing more details about the type of change (e.g., 'changed', 'deleted', 'created').
EXIT STATUS
The command typically exits with a status of 0 if it successfully monitors the file and exits cleanly. A non-zero exit status usually indicates an error, such as an invalid file path or a problem connecting to the GVfs daemon.