Rsyncing Windows directory to a Linux box: problem with spaces in directory names

Wayne Davison wayned at samba.org
Wed Dec 17 13:03:15 EST 2003


On Wed, Dec 17, 2003 at 09:05:50AM +0900, Charles Nadeau wrote:
> backup=`cat /etc/snapshot/include.text`
> rsync -va [...] $backup $backuproot/$type.1/

This is entirely a shell issue -- the shell you are using is splitting
the args at all whitespace, and you need to tell it to stop.  In fact,
in some shells $backup would always refer to a single arg unless you run
the line through an extra "eval ..." sequence (bourne shell and bash
does way too much word splitting for my tastes, for instance).

One option is to use a more advanced shell expansion of the file into
args.  In zsh (my shell of choice), you can do something like this:

  rsync -va --OPTIONS "${(f)$(</path/include.text)}" $backuproot/$type.1/

This takes the contents of the include.text file, splits in by lines,
and quotes each one as a separate arg.  If you're not using zsh, perhaps
someone familar with the shell you are using can assist you with
something similar.

Another option is to upgrade to the CVS version (available in the near
future as version 2.6.0) and use the --files-from option to specify your
files (since it already parses the names one per line).

..wayne..



More information about the rsync mailing list