DO NOT REPLY [Bug 4621] "-p" option to simulate "mkdir -p" for rsync

samba-bugs at samba-bugs at
Sun Jul 13 01:58:56 GMT 2008

------- Comment #3 from matt at  2008-07-12 20:58 CST -------
If this option is added to rsync, I suggest calling it --create-dest-parents
because -p is already taken.

(In reply to comment #2)
> It appears that rsync is invoking the "mkdir" command without the "-p" option,
> which limits its folder creation to only one directory, instead of allowing it
> to create a tree of directories.

Note that rsync uses the mkdir(2) system call, not the mkdir(1) command, so it
would have to loop over the parents of the destination itself.

Two currently supported workarounds:

1. Cut off the portion of the destination path that needs to be created, and
instead prepend it to the file-list paths of all the source files by accessing
the source through an appropriately named symlink with --relative.

2. Run a "mkdir -p" command before rsync.  If the destination is local, use a
wrapper like the one in comment #1; if it's over remote shell, use
--rsync-path; and if it's on a daemon, define a "pre-xfer exec" script that
determines the destination directory from the RSYNC_* environment variables and
creates it.

Configure bugmail:
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the rsync mailing list