Filenames with blanks

tim.conway at tim.conway at
Mon Aug 26 11:28:00 EST 2002

How embarraskin'!  I suppose that might work.  Go fig!

Tim Conway
tim.conway at
303.682.4917 office, 303.921.0301 cell
Philips Semiconductor - Longmont TC
1880 Industrial Circle, Suite D
Longmont, CO 80501
Available via SameTime Connect within Philips, caesupport2 on AIM
"There are some who call me.... Tim?"

Wayne Davison <wayned at>
Sent by: rsync-admin at
08/24/2002 12:41 PM

        To:     jw schultz <jw at>
        cc:     Ivan kovalev <ivan at>
<rsync at>
(bcc: Tim Conway/LMT/SC/PHILIPS)
        Subject:        Re: Filenames with blanks

On Sat, 24 Aug 2002, jw schultz wrote:
> Your example does not scan src_host it scans targ_host.

Not so.  If you look carefully at Ivan's quoting, you'll note that
he put the backticks inside single quotes, which saves them for the
$src_host.  For instance:

    COM='`ls -1d f*`'
    rsync -av $src_host:"$COM" /tmp

That command would work just like this simpler command:

    rsync -av $src_host:f\* /tmp

Ivan Kovalev wrote:
> COM='`find '$src_dir'  -mtime -'$days' -type f `'
> rsync -rxlupogtSvve ssh  $src_host:"$COM" $targ_dir

The quoting problem is a shell problem due to the backticks.  Backticks
split the string at spaces, regardless of the quoting or backslashing
that you may attempt to use in the output (which is ignored because the
shell isn't doing parsing there, just word-splitting).  To fix this,
you'll have to affect how the backticks split the output.  I can't
figure out a way to get rsync to set IFS in the right spot to affect
just the backtick expansion, so perhaps the only solution is to use a
different command-running syntax.

If your login shell is zsh, you could use this command:

    COM='${(f)"$(find '$src_dir' -mtime -'$days' -type f)"'

This quotes the find command's output (so that it doesn't get split),
and then explicitly splits the output based on newlines.  I don't know
if bash has something similar (since I don't use bash).


To unsubscribe or change options:
Before posting, read:

More information about the rsync mailing list