How to escape spaces in rsync source and destination paths

Carney Mimms Carney.Mimms at nourison.com
Wed Aug 20 14:32:23 GMT 2008


This may not be an rsync-specific question, but it is certainly stopping me
from moving forward with rsync and I am sure it has a simple solution. I
have written a simple shell script to rsync disks attached to a Mac OS X
Server 10.4.11 Xserve box at our offices to a similar Mac OS X Server
10.4.11 setup at our colocation facility. The script runs rsync 3.0.3 on the
machine at the colocation facility but syncs the disks at our office back to
its own disks, so DIRS is the path to the directory being backed up, which
is remote, and BACKUP DIR is the path to the backup destination, which is on
the machine running the script.

The script works fine, except when I try to specify paths containing spaces.
As you can see from the script excerpts below and the result, the backslash
escape character isn't getting the job done and I can't figure out why. I've
never had any trouble using the backslash escape in this way before.

Can anyone suggest a different approach, other than renaming all my paths to
eliminate spaces, which is the direction I seem to be heading :-)

--------------------------------------------------------

DIRS="admin at 192.168.100.47:/Volumes/Christine/Complete_Rug_Image_Archive/Lay
ered\ Rooms/"

BACKUPDIR="/Volumes/Paris/Complete_Rug_Image_Archive/Layered\ Rooms/"

COMMAND="sudo /usr/local/bin/rsync  $OPTS $EXCLUDES $DIRS $BACKUPDIR"

result:

Unexpected local arg: Rooms/
If arg is a remote file/dir, prefix it with a colon (:).
rsync error: syntax or usage error (code 1) at main.c(1216) [receiver=3.0.3]
----------------------------------------------------------

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the rsync mailing list