Filenames with blanks

Ivan kovalev ivan at wssource.com
Sat Aug 24 09:53:00 EST 2002


That's almost exactly what I did (and what makes me scratch my head). I
have 2 test scripts that take output from find (from pipe) and quote
either full path name for each file or just last part (file name). The
output from rsync below shows that in this case it fails even on a single
word filenames:
link_stat /home/wss_disk/calendar.data/'Economic' : No such file ...

Here is a test find command as I run it on the source host:
SRC /home/ivan 8$ find . -name "test *" |quotelast
./'test file'
./'test file2'
SRC /home/ivan 9$ find . -name "test *" |quoteall
'./test file'
'./test file2'
SRC /home/ivan 10$

Ivan

On Sat, 24 Aug 2002, Charles R. Jones wrote:

> I'm not a shell script expert but I think if you used something like
> this:
>
> Make a script 'getflist.sh':
> for filename in `find '$src_dir'  -mtime -'$days' -type f `
> do
>    echo -n \'$filename\'' '
> done
> ----------
>
> And used it like this:
> COM=`getflist.sh`
> rsync  -rxlupogtSvve ssh  $src_host:"$COM" $targ_dir
>
> It might work since the 'getflist.sh' script returns a list like so:
> '/src_dir/file1' '/src_dir/file2' '/src_dir/file3'
>
>
> -----Original Message-----
> From: rsync-admin at lists.samba.org [mailto:rsync-admin at lists.samba.org]
> On Behalf Of Ivan kovalev
> Sent: Saturday, August 24, 2002 9:05 AM
> To: jw schultz
> Cc: rsync at lists.samba.org; ivan at wssource.com
> Subject: Re: Filenames with blanks
>
>
> I did not see Tim's note and what you tell about it sounds like
> misunderstanding.
>
> 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/calendar.data/'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/calendar.data/'Conference : No such file or
> > > directory
> > > link_stat Calls' : No such file or directory
> > > link_stat /home/wss_disk/calendar.data/'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/calendar.data/Conference foo
> > 	/home/wss_disk/calendar.data/Economic bar
> >
> > The result being this command line
> > 	rsync  -rxlupogtSvve ssh
> > $src_host:"/home/wss_disk/calendar.data/Conference foo
> > /home/wss_disk/calendar.data/Economic 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 pegasys.ws
> >
> > 		Remember Cernan and Schmitt
> >
>
> --
> To unsubscribe or change options:
> http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read:
> http://www.tuxedo.org/~esr/faqs/smart-questions.html
>
>
>




More information about the rsync mailing list