Example:
rsync /tmp/fol1/fol2/fol3/foln user@addr:/tmp/fol1/fol2/fol3/foln
My main problem is folder /tmp/fol1 doesn't exist on remote machine.
Which arguments can I use to force rsync to create this tree?
Rsync creates a directory with the same name inside of destination directory - Server Fault. Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Method 1: Updating newer files locally with rsyncThe “-u” or the “–update” option forces rsync to skip that files in your destination directory that are still new, and the “-n” or the “–dry run” option is for testing the update process. Now, remove the “-n” option and quickly update the rsync command execution.
If you want to copy a directory with its sub-directory and all contents from one location to another within your system, you can do so as by typing rsync followed by the source and destination directory. Note: Specifying “/” after the source directory only copies the contents of the directory.
Similarly, the rsync skipping directory error can occur when miss to put it into a recursive mode like -r or -a. In addition, use -a instead of -r. -a means to reproduce file hierarchies, including special files and permissions. Also, the option -r only to recurse on directories whereas -a needed for a data backup.
I ran into same issue today and found the solution here.
You can either do:
rsync -avR foo/bar/baz.c remote:/tmp/
or:
rsync -avR somedir/./foo/bar/baz.c remote:/tmp/
to create /tmp/foo/bar/baz.c in the remote machine.
see --relative/-R
section of man rsync
for more details.
One trick to do it is to use the --rsync-path
parameter with the following value:
--rsync-path="mkdir -p /tmp/fol1 && rsync"
With --rsync-path you can specify what program is going to be used to start rsync in the remote machine and is run with the help of a shell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With