Problems with spaces in filenames in scripts

Francis Montagnac Francis.Montagnac at
Fri Jan 18 20:40:09 EST 2002

> Heh.. no sooner than I post this, it gets solved by my
> neighbour... this might help someone else, so here is the
> solution...
> opts='-rav --modify-window=2 --stats --partial --compress --timeout=30 
> "localhost::module_name/dir/file with spaces.doc"  "/smb/dir/dir with
> spaces/" '

> eval rsync $opts

Or without re-evaluating (beware: it's bash specific): using an array
and quoting it when calling rsync:

opts=(-rav --modify-window=2 --stats --partial --compress --timeout=30 
"localhost::module_name/dir/file with spaces.doc"  "/smb/dir/dir with

rsync "${opts[@]}"

More information about the rsync mailing list