/** * <pre> * rsync [options] source destination * rsync [options] source [user@]hostname:destination * rsync [options] [user@]hostname:source destination * </pre> * * Always add a trailing slash to source when sync'ing directories.<br> * This forces rsync to behave like <code>cp</code> * * <pre> * cp -R /tmp/foo/bar /tmp/xyz - creates files in /tmp/xyz * rsync /tmp/foo/bar/ /tmp/xyz - creates files in /tmp/xyz * * rsync /tmp/foo/bar /tmp/xyz - creates files in /tmp/xyz/bar * </pre> */ public static final int rsyncdirs(List<String> options, String source, String destination) { List<String> rsyncDirOptions = getRsyncDirOptions(options); // Make sure source always has a trailing slash String trailingSlashSource = StringUtils.endsWith(source, FORWARD_SLASH) ? source : source + FORWARD_SLASH; return rsync(rsyncDirOptions, trailingSlashSource, destination); }