Filenames with blanks

jw schultz jw at
Fri Aug 23 18:03:01 EST 2002

On Fri, Aug 23, 2002 at 06:09:21PM -0400, Ivan Kovalev wrote:
> Command like this:
>     rsync  -rxlupogtSvve ssh
> $src_host:"/home/wss_disk/'Conference Calls'" $targ_dir
> works fine with blanks embeded in the file name.
> When I try to script it like this:
>     COM='`find '$src_dir'  -mtime -'$days' -type f `'
>     rsync  -rxlupogtSvve ssh  $src_host:"$COM" $targ_dir
> works fine on regular filenames, but does not see the ones with blanks
> in the middle.
> I changed my COM to pipe through little script to produce the same
> output where either the whole filepath or just the file name will be
> quoted (as in the first example). That breakes it complitely and this
> version does not work even for single word files. Output looks like
> this:
> .......................
> receiving file list ...
> link_stat /home/wss_disk/'Conference : No such file or
> directory
> link_stat Calls' : No such file or directory
> link_stat /home/wss_disk/'Economic' : No such file or
> directory
> I probably am missing something simple, but could not figure what is it.
> Please advise. Thank you.

As Tim pointed out scanning $dest_host for files that
were recently modified to overwrite them if they were
changed on the $src_host makes very little sense.

rsync handles file names with spaces just fine if you let
it.  Why do you think you need to create this file list in
the first place when you are using the -r option?

Based on your design decisions i doubt that you quite
understood  understood what Tim meant by a list so i'll
illustrate.  Your find operation means that $COM is set to
something like
	/home/wss_disk/ foo
	/home/wss_disk/ bar

The result being this command line
	rsync  -rxlupogtSvve ssh $src_host:"/home/wss_disk/ foo /home/wss_disk/ bar" $targ_dir

Putting quote marks inside $COM won't protect the spaces.
The quotes have to be outside of $COM.

If you can explain why you need the find instead of doing
	rsync  -rxlupogtSvv -e ssh $src_host:$src_dir/ $targ_dir
I'll be glad to show you how. 

	J.W. Schultz            Pegasystems Technologies
	email address:		jw at

		Remember Cernan and Schmitt

More information about the rsync mailing list