Creating intermediate directories?

Jon Drukman jsd at cluttered.com
Thu Jan 27 17:35:13 GMT 2005


Wayne Davison wrote:

>On Wed, Jan 26, 2005 at 10:28:46AM -0800, Jon Drukman wrote:
>  
>
>>And I want it to arrive on the remote machine at:
>>
>>/other/foreign/directory/file.zip
>>
>>But only /other exists, is there any way to have rsync create the 
>>intermediate directories?
>>    
>>
>
>Solution #1 (uses -R):
>
>    cd /scratch-dir
>    mkdir foreign
>    ln -s /some/local/path foreign/directory
>    rsync -avR --no-implied-dirs foreign/directory/file.zip host:/other
>    rm -rf foreign
>
>That causes rsync to duplicate the relative path dirs as dirs instead of
>making the last one a symlink.
>
>Solution #2 (sends the dirs separately):
>
>    cd /scratch-dir
>    mkdir -p foreign/directory
>    rsync -av foreign host:/other
>    rsync -av /some/local/path/file.zip host:/other/foreign/directory
>    rm -rf foreign
>
>Solution #3 (makes the dirs without using rsync):
>
>    ssh host mkdir -p /other/foreign/directory
>    rsync -av /some/local/path/file.zip host:/other/foreign/directory
>
>..wayne..
>  
>
thanks wayne, i've been doing solution #3 all along, guess i'll stick 
with it.  thanks!

-jsd-



More information about the rsync mailing list