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

Michael.James at csiro.au Michael.James at csiro.au
Fri Jun 15 00:26:51 GMT 2007


On Fri, 15 Jun 2007 09:50:47 am Stephen Hodgman wrote:
> 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?

Having the receiving stub in place
 is something that rsync doesn't see as its problem.

It can do it, but manually:
mkdir /tmp/C
rsync -zav /tmp/C remotehost::Share/A/B/
rmdir /tmp/C

Perhaps a bit of shell wrapper.


Alternatively make the part that you know already exists remotely
 the "trunk" of the rsync, and use exclude lists
 to only get the branch you want transferred.

cat exclude-list
+ /C/
+ /C/D/
- /C/*

rsync -zav --exclude-from=exclude-list  /A/B/C remotehost::Share/A/B/

I haven't tested it, experiment locally first.
michaelj

PS: Already two similar replies, Oh well...

-- 
Michael James                         michael.james at csiro.au
System Administrator                    voice:  02 6246 5040
CSIRO Bioinformatics Facility             fax:  02 6246 5166

No matter how much you pay for software,
 you always get less than you hoped.
Unless you pay nothing, then you get more.


More information about the linux mailing list