How to escape spaces in rsync source and destination paths

Wayne Davison wayned at samba.org
Wed Aug 20 15:23:31 GMT 2008


On Wed, Aug 20, 2008 at 10:32:23AM -0400, Carney Mimms wrote:
> COMMAND="sudo /usr/local/bin/rsync  $OPTS $EXCLUDES $DIRS $BACKUPDIR"

That's a sudo issue, since sudo runs the command and splits the args on
spaces.  You need to either add extra backslashes (\\\ for every \), add
extra quoting (e.g. "'$DIRS'", which would only work for a single name),
or put the source args into a file and use --files-from (with an
explicit -r if you're expecting recursion).

..wayne..


More information about the rsync mailing list