Rsyncing Problem with - character!
jw at pegasys.ws
Fri May 30 20:31:45 EST 2003
On Fri, May 30, 2003 at 11:06:51AM +0100, 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
> Any ideas what I can do to make this work?
Curious one. It isn't the dash that is the problem but the
spaces. They are getting interpolated away by the multiple
layers of shells. If not for the dash it would have created
a file called "Draft" discarding the rest of the filename.
Two approaches seem to work. The first is an extra layer of
rsync -av "file with space in name" server:"'t/file with space in name'"
Notice the nested "'finame'" The outermost layer get
stripped by ssh, the inner by the sh process ssh starts.
The other approach is to not specify the destination
filename on the commandline:
rsync -av "file with space in name" leto:t/
I hate spaces in filenames!
I have been known to cron scripts that traversed
trees renaming space filled filenames. The users
never noticed but for the fact that operations that
previously failed now worked most of the time.
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync