Date: Sun, 22 Apr 2001 06:15:07 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Brian Somers <brian@Awfulhak.org> Cc: Sheldon Hearn <sheldonh@uunet.co.za>, "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net>, Brian Dean <bsd@bsdhome.com>, Jens Schweikhardt <schweikh@schweikhardt.net>, freebsd-current@FreeBSD.ORG Subject: Re: cp -d dir patch for review (or 'xargs'?) Message-ID: <Pine.BSF.4.21.0104220611130.4815-100000@besplex.bde.org> In-Reply-To: <200104211856.f3LIug547373@hak.lan.Awfulhak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 21 Apr 2001, Brian Somers wrote: > > On Sat, 21 Apr 2001 14:06:04 +0100, Brian Somers wrote: > > > > > How do you do this in a script: > > > > > > cd /topdir; find . -type f | xargs -i {} cp {} /otherdir/. > > > > for i in `find /path/to/source -type f`; do > > cp $i /path/to/dest/ > > done > > > > What's all the fuss about? > > Have you tried that for values of /path/to/source with lots of files ? > Something like > > find blah | while read i; do cp $i /dest/.; done > > is better, but it runs cp too many times. cp is a bad example, since it usually does physical i/o which is much slower than execve() of a program that is probably cached, especially when the program is small and not dynamically linked. Bruce 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?Pine.BSF.4.21.0104220611130.4815-100000>