Date: Sun, 15 Aug 2004 11:20:15 +0930 From: "Paul A. Hoadley" <paulh@logicsquad.net> To: freebsd-questions@freebsd.org Subject: Re: find -exec surprisingly slow Message-ID: <20040815015015.GE25751@grover.logicsquad.net> In-Reply-To: <p06110400bd4454ff72b3@[128.113.24.47]> References: <20040814230143.GB8610@grover.logicsquad.net> <p06110400bd4454ff72b3@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040815015015.GE25751>