On Mon, 2007-10-29 at 19:44 +0200, Pournaris Charalampos
wrote:> If I have a directory tree in the source machine like the following:
> 192.168.1.1 => /raid/system/mainfolder/folder1/subfolder/myfile.txt
>
> and the target machine directory tree looks like:
> 192.168.1.2 => /raid/system/mainfolder/
>
> Is there a way to send myfile.txt to the target machine and force rsync
> to create the target directories (/folder1/subfolder) ?
Yes, you can use --relative and a ./ in a source argument to recreate
the path information after the ./ inside the destination:
rsync --relative <options>
/raid/system/mainfolder/./folder1/subfolder/myfile.txt
192.168.1.2:/raid/system/mainfolder/
> If mkdir could be used with the '-p' argument by rsync, the above
> command would work, I think. Any ideas?
That would not be possible because rsync uses the mkdir system call, not
the mkdir command-line tool that has the -p option. Code to create
ancestors of the destination could be added to rsync, but I'm not
convinced that it should be. You can always add your own "mkdir -p"
to
your script; use --rsync-path='mkdir -p ... && rsync' if you
need it to
happen on the remote side.
Matt