From owner-freebsd-current Sat Apr 21 13:18:47 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 805E937B424 for ; Sat, 21 Apr 2001 13:18:44 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id GAA06924; Sun, 22 Apr 2001 06:16:10 +1000 Date: Sun, 22 Apr 2001 06:15:07 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Brian Somers Cc: Sheldon Hearn , "Rodney W. Grimes" , Brian Dean , Jens Schweikhardt , freebsd-current@FreeBSD.ORG Subject: Re: cp -d dir patch for review (or 'xargs'?) In-Reply-To: <200104211856.f3LIug547373@hak.lan.Awfulhak.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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