Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Apr 2001 19:30:45 +0200
From:      "Karsten W. Rohrbach" <karsten@rohrbach.de>
To:        Brian Dean <bsd@bsdhome.com>
Cc:        Sheldon Hearn <sheldonh@uunet.co.za>, freebsd-current@FreeBSD.ORG
Subject:   Re: cp -d dir patch for review (or 'xargs'?)
Message-ID:  <20010422193044.B92712@mail.webmonster.de>
In-Reply-To: <20010421162436.A56976@vger.bsdhome.com>; from bsd@bsdhome.com on Sat, Apr 21, 2001 at 04:24:36PM -0400
References:  <200104211527.RAA06452@lurza.secnetix.de> <67741.987867271@axl.fw.uunet.co.za> <20010421162436.A56976@vger.bsdhome.com>

next in thread | previous in thread | raw e-mail | index | archive | help
rohrbach@WM:datasink[~]68% tar cf /dev/null src/
rohrbach@WM:datasink[~]69% find src|wc -l
    2552
rohrbach@WM:datasink[~]70% du -sk src
32258   src
rohrbach@WM:datasink[~]71% mkdir src2
rohrbach@WM:datasink[~]72% time find src -exec cp {} src2 \; 
find src -exec cp {} src2 ;  0.31s user 7.55s system 39% cpu 19.858 total).
rohrbach@WM:datasink[~]73% rm -rf src2
rohrbach@WM:datasink[~]74% mkdir src2
rohrbach@WM:datasink[~]75% time find src | cpio -dup src2
61025 blocks
find src  0.02s user 0.03s system 0% cpu 21.739 total
cpio -dup src2  0.26s user 4.84s system 20% cpu 24.862 total

68: warm up the filecache
69: there are 2552 files
70: they are 32.2MB total
71: ready the target dir
72: find -exec approach, all files to one dir
73: clear target area
74: ready it again
75: let find traverse the dir, cpio transfer the files

the cpio approach keeps the hierarchy which might not be what you want
but it looks more efficient, becouse it does not fork off cp for ecery
file.

/k

Brian Dean(bsd@bsdhome.com)@2001.04.21 16:24:36 +0000:
> On Sat, Apr 21, 2001 at 05:34:31PM +0200, Sheldon Hearn wrote:
> 
> > So we have two problems:
> > 
> > 1) Calling cp(1) repetitively is inefficient.
> > 
> > 2) The argument list is too big for cp(1).
> > 
> > Extending cp(1) will not solve (2).  Extending xargs(1) will solve both.
> > So why is an extension to cp(1) being proposed?
> 
> But extending cp does solve the problem.  The proposal was to make
> 
> 	% cp -d target src1 src2 ... srcN
> 
> Be equivalent to;
> 
> 	% cp src1 src2 ... srcN target
> 
> This makes cp work with xargs;
> 
> 	% cat ReallyBigListOfFiles | xargs cp -d target
> 
> -Brian
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

-- 
> Captain Hook died of jock itch.
KR433/KR11-RIPE -- http://www.webmonster.de -- ftp://ftp.webmonster.de
[Key] [KeyID---] [Created-] [Fingerprint-------------------------------------]
GnuPG 0x2964BF46 2001-03-15 42F9 9FFF 50D4 2F38 DBEE  DF22 3340 4F4E 2964 BF46

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010422193044.B92712>