fracpete / rsync4j

Simple Java wrapper for rsync for Linux, OSX and Windows.

Home Page:https://fracpete.github.io/rsync4j/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failure when specifying multiple source directories on Linux (Ubuntu)

ctonsing opened this issue · comments

rsync itself allows multiple source folders to be specified by simply listing them separated by spaces. If I do the same using rsync4j, it works on Windows when surrounding each directory with double quotes, e.g. like this:

RSync rsync = new RSync().source("\"/home/user/test1\" \"/home/user/test2\"");

However, this same approach does not work on Linux. I have tried with different variations, with or without quotes, different kinds of quotes, but it does not seem to be possible. For the above example, the error given by rsync is something along the lines of:

rsync: link_stat "/path/to/current/dir/"/home/user/test1" "/home/user/test2"" failed: No such file or directory (2)

Any idea how to get this scenario working with rsync4j?

That it works under Windows must be a fluke. I will extend the wrapper to make this feature possible.

I just made a new release (3.1.2-14). With that release you can now use the sources(String[]) or sources(List<String>) methods to define multiple source paths/urls.
NB: It might still take some time before the artifacts show up on Maven Central.

Nice!! Thank you very much Peter, will check it out!