non-existing parent directories

Matt McCutchen hashproduct+rsync at
Thu Oct 19 19:59:31 GMT 2006

On 10/19/06, Darin Perusich <Darin.Perusich at> wrote:
> is there a way for rsync to create non-existing parent directories when
> syncing files to a destination? something similar to 'mkdir -p
> non-existing/directory'. i'm doing 'rsync -r /path/to/source
> /path/to/non-existing/directory', and the 'non-existing/directory'
> location doesn't exist.

Rsync will only create the top-level destination directory, not its
parents.  So just run an appropriate "mkdir -p" command before rsync.
If this needs to happen on the remote host of a transfer over SSH,
pass rsync something like --rsync-path="mkdir -p
/path/to/non-existing/directory && rsync".


More information about the rsync mailing list