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.
--
Ivan Kovalev
Wall Street Source
120 Broadway, 27-th floor
New York, NY 10271
Pager: ikovalev@skytel.com, (888)688-5202
Phone: (212)479-1445
E-mail: ivan@wssource.com
The output of the file list is treated as a list. The easiest solution
would be to iterate through the list.
Now, you understand that as you have constructed this, you create a
commandline in a variable. In the "$COM" you are executing that
commandline, and putting its contents as a part of the $src_host: token.
The find is NOT being executed on the remote, so what you are doing is
asking the remote for its copy of each file you have a file in $src_dir
that is less than $days old. Is that actually what you want?
A better solution to the spaces problem is
++++++++++++++++++++++++++++++++++++++++++++++++++++++
find $srcdir -print |
grep ' ' |
while read item
do
mv $item `echo $item |tr ' ' _`
done
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yeah, I know you CAN have spaces in filenames, but it's such a pain in the
ass, just to satisfy some luser who wants to use them.
Tim Conway
tim.conway@philips.com
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?"
Ivan Kovalev <ivan@wssource.com>
Sent by: rsync-admin@lists.samba.org
08/23/2002 04:09 PM
To: rsync@lists.samba.org
cc: (bcc: Tim Conway/LMT/SC/PHILIPS)
Subject: Filenames with blanks
Classification:
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.
--
Ivan Kovalev
Wall Street Source
120 Broadway, 27-th floor
New York, NY 10271
Pager: ikovalev@skytel.com, (888)688-5202
Phone: (212)479-1445
E-mail: ivan@wssource.com
--
To unsubscribe or change options:
http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html
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@pegasys.ws Remember Cernan and Schmitt
How embarraskin'! I suppose that might work. Go fig!
Tim Conway
tim.conway@philips.com
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@users.sourceforge.net>
Sent by: rsync-admin@lists.samba.org
08/24/2002 12:41 PM
To: jw schultz <jw@pegasys.ws>
cc: Ivan kovalev <ivan@wssource.com>
<rsync@lists.samba.org>
(bcc: Tim Conway/LMT/SC/PHILIPS)
Subject: Re: Filenames with blanks
Classification:
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).
..wayne..
--
To unsubscribe or change options:
http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Apparently Analagous Threads
- Selective sync
- Interesting problem with samba and .ntprofile
- [LLVMdev] Add ability for external projects use for build installed version LLVM [PATCH]
- [LLVMdev] Add ability for external projects use for buildinstalled version LLVM [PATCH]
- IO error encountered -- skipping file deletion