Forrest logo
back to the rsync tool

rsync:file:remote-to-local:with-deletion

Transfer a file over SSH and delete remote files that do not exist locally.
$ rsync -e ssh --delete ${remote_host}:${path-to-remote_file} ${path-to-local_file}
try on your machine

This command uses the rsync utility to copy files from a remote system to a local system over an SSH connection.

  • The "-e ssh" option tells rsync to use SSH for the transport protocol to securely transfer the files.
  • The "--delete" option sends a request to delete any extra files that exist in the destination directory that do not exist in the source directory.
  • "${remote_host}" is the name or IP address of the remote system.
  • "${path-to-remote_file}" is the file or directory to be transferred from the remote system.
  • "${path-to-local_file}" is the destination directory or location on the local system where the files will be transferred to.
This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the rsync tool