sysrsync icon indicating copy to clipboard operation
sysrsync copied to clipboard

Allow multiple sources

Open LevN0 opened this issue 4 years ago • 2 comments

Rsync supports multiple source paths. For example,

When source is local:

rsync /path/to/file1 /path/to/file2 /path/to/file3 user@ip:/dest/path/

When source is remote:

rsync user@ip:/path/to/file1 user@ip:/path/to/file2 user@ip:/path/to/file3 /dest/path/

The code here supports only a single source, although I think the adjustment would be straightforward.

LevN0 avatar Sep 24 '21 23:09 LevN0

Nice catch, no idea why I haven't thought about it earlier.

My consideration for this is whether to support both string and list of strings for the source argument (Union[str, Iterable[str]]) or deprecate str and later remove it. I also have to consider raising an exception if Iterable[str] (with len > 1) and source_ssh are both set.

Nevertheless, this has to be supported.

gchamon avatar Sep 25 '21 14:09 gchamon

My thinking is to accept Union[str, Iterable[str]] for the source argument. Why the exception if Iterable[str] (with len > 1) and source_ssh are both set? I was thinking the source would continue specifying the source directories, whereas source_ssh would continue specifying the remote client. rsync requires all source directories to come from the same machine.

It does appear the remote syntax I specified above works only on newer versions (at least 3.x, which is 10+ years old), and apparently even recent versions of OSX ship with rsync 2.x. See comment chain here. Rsync man discusses this somewhat here. Not sure it's worth supporting such an old version of rsync, but if so then you need a different syntax and to be with spaces in paths.

LevN0 avatar Sep 25 '21 15:09 LevN0