From owner-freebsd-questions@FreeBSD.ORG Sun Aug 15 01:50:20 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D2A5B16A4CE for ; Sun, 15 Aug 2004 01:50:20 +0000 (GMT) Received: from grover.logicsquad.net (ppp52-132.lns1.adl2.internode.on.net [150.101.52.132]) by mx1.FreeBSD.org (Postfix) with SMTP id 1648D43D3F for ; Sun, 15 Aug 2004 01:50:19 +0000 (GMT) (envelope-from paulh@logicsquad.net) Received: (qmail 50218 invoked by uid 1000); 15 Aug 2004 01:50:16 -0000 Date: Sun, 15 Aug 2004 11:20:15 +0930 From: "Paul A. Hoadley" To: freebsd-questions@freebsd.org Message-ID: <20040815015015.GE25751@grover.logicsquad.net> References: <20040814230143.GB8610@grover.logicsquad.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XF85m9dhOBO43t/C" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Subject: Re: find -exec surprisingly slow X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2004 01:50:20 -0000 --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 14, 2004 at 08:11:54PM -0400, Garance A Drosihn wrote: > Where is '.' in the above `find .' command? Is it is on the same > partition as /home/paulh/tmp/spam/sne/ ? >=20 > You may find it much faster to do something like: > mkdir usermail.new > chown user:group usermail.new > mv usermail usermail.bigspam > mv usermail.new usermail > cd usermail.bigspam > find . \! -atime +1 -exec mv {} ../usermail \; >=20 > My assumption there is that you have a LOT fewer "good files" than > you have "bad files", so there will be fewer files to move. But I > am also making the assumption that all your files are in a single > directory (and not a tree of directories), which may be a bad > assumption. All assumptions correct, and that is what I should have done. > The thing to use is the '-J' option of xargs. That way you can have > the destination-directory be the last argument in the command that > gets executed, and yet you're still moving as many files in a single > `mv' command as possible. E.g., change my earlier `find' command > to: > find . \! -atime +1 -print0 | xargs -0J[] mv [] ../usermail >=20 > Check the man page for xargs for a description of -J Will do. Thanks for the tip. --=20 Paul. w http://logicsquad.net/ h http://paul.hoadley.name/ --XF85m9dhOBO43t/C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFBHsFX730Z/jysbzIRAhf9AJ9c+xFx8hpV2yks6i28uu7AM3qpUQCfYKST 6V9dSCf60l+Z45pISI6KfSY= =xCoq -----END PGP SIGNATURE----- --XF85m9dhOBO43t/C--