Force parent directories creation

Pournaris Charalampos charpour at gnet.gr
Mon Oct 29 17:44:37 GMT 2007


Hello,

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) ?

When I use a command like (from the machine with ip 192.168.1.1):
rsync -av -e rsh "/raid/system/mainfolder/folder1/subfolder/myfile.txt" 
192.168.1.2:"/raid/system/mainfolder/folder1/subfolder/" --progress

I get the following error:
building file list ...
1 file to consider
rsync: mkdir "/raid/system/mainfolder/folder1/subfolder/" failed: No 
such file or directory (2)
rsync error: error in file IO (code 11) at main.c(529) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(434)

If mkdir could be used with the '-p' argument by rsync, the above 
command would work, I think. Any ideas?

Thanks for your time

-- 
Charalampos Pournaris
charpour at gnet.gr



More information about the rsync mailing list