Skip to content


Removes the file or directory on the remote machine.

distant fs remove /path/to/file.txt


  • --force: if provided, will remove non-empty directories.


  • This command will fail if provided a non-empty directory unless the force flag is specified.
  • Relative paths resolve to the current working directory of the server.
distant fs remove --help
Removes a file or directory on the remote machine

Usage: distant fs remove [OPTIONS] <PATH>

  <PATH>  The path to the file or directory on the remote machine

      --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)
      --force                        Whether or not to remove all contents within directory if is a directory. Does nothing different for files
  -h, --help                         Print help