[clug] rsync - how to create path on remote server

Peter Barker pbarker at barker.dropbear.id.au
Fri Jun 15 00:12:30 GMT 2007


On Fri, 15 Jun 2007, Stephen Hodgman wrote:

> know if the the complete remote path exists.
> e.g. My path is /A/B/C/D/ and I need to put this under the remote server tree 
> /A etc
> However, if for example the "C" directory does not pre-exist on the remote 
> server my command
> rsync -zav /A/B/C/D remotehost::Share/A/B/C
> will not work.  If the "C" folder does exist it will.  How do I get rsync to 
> "auto create"  the "C" folder?

I can't see any way of getting rsync to do that directly.  OTOH, you 
could try:

mkdir $TMP/empty
for i in A A/B A/B/C; do
  rsync -a $TMP/empty remotehost::Share/$i
done
rsync -zav /A/B/C/D remotehost::Share/A/B/C
rmdir $TMP/empty

> Stephen Hodgman

Yours,
-- 
Peter Barker                          |   Programmer,Sysadmin,Geek.
pbarker at barker.dropbear.id.au	      |   You need a bigger hammer.
:: It's a hack! Expect underscores! - Nigel Williams


More information about the linux mailing list