Skip to content

Watch

Watch a path for changes on the remote machine.

distant fs watch /path/to/file.txt

Flags

  • --recursive: indicates that a path should be watched recursively, meaning that if it is a directory, any changes within the directory will also be watched and reported (e.g. new file, changed contents, deleted within).
  • --only <EVENT>: limit events being reported to only the one specified. This parameter can be provided more than once to limit to multiple different events.
  • --except <EVENT>: limit events being reported to all but the one specified. This parameter can be provided more than once to exclude multiple events.

Events

  • access: reported when a file is accessed.
  • attribute: reported when some attribute such as file permissions is changed.
  • close_write: reported when a file is closed that was opened for writing.
  • close_no_write: reported when a file is closed that was not opened for writing.
  • create: reported when a file or directory is deleted. This only is reported within a recursively-watched directory.
  • delete: reported when a file or directory is deleted.
  • modify: reported when a file's contents are modified.
  • open: reported when a file is opened.
  • rename: reported when some path gets renamed.
  • unknown: reported when some other event that is not supported is encountered.

Notes

  • Relative paths resolve to the current working directory of the server.
distant fs watch --help
Watch a path for changes on the remote machine

Usage: distant fs watch [OPTIONS] <PATH>

Arguments:
  <PATH>  The path to the file, directory, or symlink on the remote machine

Options:
      --cache <CACHE>                Location to store cached data [default: /home/runner/.cache/distant/cache.toml]
      --log-level <LOG_LEVEL>        Log level to use throughout the application [possible values: off, error, warn, info, debug, trace]
      --connection <CONNECTION>      Specify a connection being managed
      --log-file <LOG_FILE>          Path to file to use for logging
      --config <CONFIG_PATH>         Configuration file to load instead of the default paths
      --unix-socket <UNIX_SOCKET>    Override the path to the Unix socket used by the manager (unix-only)
      --windows-pipe <WINDOWS_PIPE>  Override the name of the local named Windows pipe used by the manager (windows-only)
      --recursive                    If true, will recursively watch for changes within directories, othewise will only watch for changes immediately within directories
      --only <ONLY>                  Filter to only report back specified changes [possible values: access, attribute, close_write, close_no_write, create, delete, modify, open, rename, unknown]
      --except <EXCEPT>              Filter to report back changes except these specified changes [possible values: access, attribute, close_write, close_no_write, create, delete, modify, open, rename, unknown]
  -h, --help                         Print help