Problem with sync files when no dir in the destin

Wayne Davison wayned at
Wed Feb 20 00:08:06 GMT 2008

On Tue, Feb 19, 2008 at 03:14:52PM -0800, Anselmo Battisti wrote:
> rsync -a Souce/FolderA/File1 Destini
> it's copy the File 1 to Destini but i would like who rsync create te Folder A in the destini and put the File 1 inside Then.

If you have a new enough rsync (at least 2.6.7), you can do this:

  rsync -aR Souce/./FolderA/File1 Destini

The -R (--relative) option says that you want path information to be
duplicated from the source files, and the "/./" dir is used to indicate
where in the path the duplication should begin (with the default being
the entire path if no "/./" dir is specified).

If you have an older rsync, you need to chdir before the copy because
it doesn't understand the "/./" dir idiom:

  chdir Souce
  rsync -aR FolderA/File1 ../Destini


More information about the rsync mailing list