Function: dired-rsync--remote-to-remote-cmd

dired-rsync--remote-to-remote-cmd is a natively compiled function defined in dired-rsync.el.

Signature

(dired-rsync--remote-to-remote-cmd SHOST SPORT SFILES DUSER DHOST DPORT DPATH)

Documentation

Construct and trigger an rsync run for remote copy.

The source SHOST and SFILES to remote DUSER @ DHOST to DPATH.

rsync doesn't support this mode of operation but we can fake it by providing a port forward from the source host which we pass onto the destination. This requires ssh'ing to the source and running the rsync there.

Source Code

;; Defined in /nix/store/i42d1fmg6q3dci37c05j415vhqjrzi15-emacs-packages-deps/share/emacs/site-lisp/elpa/dired-rsync-20261005.758/dired-rsync.el
;; ref: https://unix.stackexchange.com/questions/183504/how-to-rsync-files-between-two-remotes
(defun dired-rsync--remote-to-remote-cmd (shost sport sfiles duser dhost dport dpath)
  "Construct and trigger an rsync run for remote copy.
The source SHOST and SFILES to remote DUSER @ DHOST to DPATH.

rsync doesn't support this mode of operation but we can fake it by
providing a port forward from the source host which we pass onto the
destination.  This requires ssh'ing to the source and running the rsync
there."
  (s-join " " (-flatten
               (list "ssh" "-A" (when sport (format "-p %s" sport))
                     "-R" (format "localhost:%d:%s:%s"
                                  (dired-rsync--get-remote-port) dhost
                                  (or dport "22"))
                     shost
                     (format
                      "\"%s %s -e \\\"%s\\\" -- %s %s@localhost:%s\""
                      dired-rsync-command
                      dired-rsync-options
                      (dired-rsync--get-remote-portfwd)
                      (s-join " " sfiles)
                      duser
                      dpath)))))