Rsyncing Problem with - character!

Tom Freeman tom.freeman at eduserv.org.uk
Fri May 30 20:31:59 EST 2003


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.

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





More information about the rsync mailing list