Filenames with blanks

Charles R. Jones drdevlin at
Sat Aug 24 06:19:00 EST 2002

I'm not a shell script expert but I think if you used something like

Make a script '':
for filename in `find '$src_dir'  -mtime -'$days' -type f `
   echo -n \'$filename\'' '

And used it like this:
rsync  -rxlupogtSvve ssh  $src_host:"$COM" $targ_dir 

It might work since the '' script returns a list like so:
'/src_dir/file1' '/src_dir/file2' '/src_dir/file3' 

-----Original Message-----
From: rsync-admin at [mailto:rsync-admin at]
On Behalf Of Ivan kovalev
Sent: Saturday, August 24, 2002 9:05 AM
To: jw schultz
Cc: rsync at; ivan at
Subject: Re: Filenames with blanks

I did not see Tim's note and what you tell about it sounds like

I am scanning src_host for files changed during last $days to update my
targ_dir on targ_host. Yes, if I do whole directory from the source
host, it works fine with "foo bar" files. The reason I do not want this
is because I need a subset of files only. Imagine big archive from which
I need to update just last couple of days.

You are right about -r option: it does nothing when I operate on the
list of files.

Quotes: I do put them around COM ( tried even "\"$COM\""). It looks to
me like if I put quotes inside COM, then rsynk looks for filenames that
include quotes as part of the name. If the qoutes are outside, then none
of the files with blanks in the name could be found because they are
treated as 2 files.

So, what is the correct syntax for quoting?

On Fri, 23 Aug 2002, jw schultz wrote:

> 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
> to show you how.
> -- ________________________________________________________________
> 	J.W. Schultz            Pegasystems Technologies
> 	email address:		jw at
> 		Remember Cernan and Schmitt

To unsubscribe or change options:
Before posting, read:

More information about the rsync mailing list