How to escape spaces in rsync source and destination paths

Kyle Crawford kcrwfrd at
Wed Aug 20 15:23:50 GMT 2008

On Aug 20, 2008, at 10:32 AM, "Carney Mimms"  
<Carney.Mimms at> wrote:

> 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 
> 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]
> ----------------------------------------------------------
You haven't shown us the Rsync portion of your script.

Are you using the protect args flag?

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

More information about the rsync mailing list