Rsyncing Problem with - character!

jw schultz jw at pegasys.ws
Fri May 30 20:48:58 EST 2003


On Fri, May 30, 2003 at 11:31:59AM +0100, Tom Freeman wrote:
> Hi,
> Thanks for the quick response, I tried out what you said and this is
> what I found.
> 
> This works:
> 
> /usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> "/export/home/tdf/Draft text - with Holley comments.doc"
> root at mymachine.mydomain.com:/home/tdf/
> 
> But no matter how you put it, I can't seem to escape out the destination
> file name. So this doesn't work
> 
> /usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> "/export/home/tdf/Draft text - with Holley comments.doc"
> "root at mymachine.mydomain.com:/home/tdf/Draft text - with Holley
> comments.doc"
> 
> neither does this
> 
> /usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> /export/home/tdf/Draft\ text\ \-\ with\ Holley\ comments.doc
> root at mymachine.mydomain.com:/home/tdf/Draft\ text\ \-\ with\ Holley\
> comments.doc
> 
> at least not with my shell.

Forget the backslashes unless you are prepared to do
something like "/home/tdf/Draft\\\\ text\\\\ \\\\-\\\\ with\\\\ Holley\\\\ comments.doc"
or worse.  You have to nest differing quotes as shown in my
example.

> 
> This is a bit of a problem because I'm using rsync within a wrapper
> written in Perl and I really don't want to have to rewrite the Perl code
> to account for this limitation... can anyone think of a way to escape
> out the destination file name so that rsync does not complain?
> 
> Your help is much appreciated,
> 
> Regards,
> Tom
> 
> -----Original Message-----
> From: Greger Cronquist [mailto:greger_cronquist at yahoo.se] 
> Sent: 30 May 2003 11:12
> To: Tom Freeman
> Subject: Re: Rsyncing Problem with - character!
> 
> Usually, when using quotes, you skip ecape-characters. Depending on your
> 
> shell, both
> 
> /usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> "/export/home/tdf/Draft text - with Holley comments.doc"
> "root at mymachine.mydomain.com:/home/tdf/Draft text - with Holley
> comments.doc"
> 
> and
> 
> /usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> /export/home/tdf/Draft\ text\ \-\ with\ Holley\ comments.doc
> root at mymachine.mydomain.com:/home/tdf/Draft\ text\ \-\ with\ Holley\
> comments.doc
> 
> should work. I prefer the former, though you could simplify it to
> 
> /usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> "/export/home/tdf/Draft text - with Holley comments.doc"
> root at mymachine.mydomain.com:/home/tdf/
> 
> 
> Regards Greger
> 
> Tom Freeman wrote:
> 
> >Dear Rsync Users,
> >Please can I have a bit of rsync advice?
> >
> >I am trying to rsync a file called.
> >
> >'Draft text - with Holley comments.doc' from machine a to machine b.
> >
> >Unfortunately this isn't working because I think rsync recognises the -
> >character and thinks it's an option.
> >
> >I have tried escaping this out as well as putting it all in " " but
> >neither seems to work though...
> >
> >This is the command I am running and the message I am getting.
> >
> >rsync: on remote machine: -: unknown option
> >rsync error: syntax or usage error (code 1) at main.c(875)
> >rsync: connection unexpectedly closed (0 bytes read so far)
> >rsync error: error in rsync protocol data stream (code 12) at io.c(150)
> >
> >/usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu --delete
> >"/export/home/tdf/Draft text \- with Holley comments.doc"
> >root at mymachine.mydomain.com:/home/tdf/Draft text \- with Holley
> >comments.doc
> >
> >Any ideas what I can do to make this work?
> >
> >Cheers,
> >Tom
> >
> >
> >  
> >
> 
> 
> --
> To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
> 

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt



More information about the rsync mailing list