A handy utility (at least for me)
Oliver Fromme
olli at lurza.secnetix.de
Tue Aug 29 10:49:59 UTC 2006
Richard Coleman wrote:
> Oliver Fromme wrote:
> > The following is probably the most efficient solution.
> > It doesn't run into all subdirectories (and works with
> > an arbitrary numebr of subdirectories).
> >
> > cd /usr/ports; echo */*/work | xargs rm -rf
>
> So does this:
>
> find /usr/ports -mindepth 3 -maxdepth 3 -name work -print -delete -prune
>
> I would be surprised if the globbing in most shells was more
> efficient than find.
Both are mainly disk-bound, so the runtime should be about
the same, I guess. (I'm too lazy to do any actual bench-
marks with find and various shells.)
> Although as mentioned before, nothing beats putting all the work
> directories in a single location, and using a single rm command.
Yes, there is something that beats it: If you put the work
directories on their own filesystem, you can simply umount
and newfs it, which is probably faster than rm -rf. If you
use a memory filesystem (md device), it's even sufficient
to just umount it. I think nothing beats that in terms of
speed. ;-)
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
$ dd if=/dev/urandom of=test.pl count=1
$ file test.pl
test.pl: perl script text executable
More information about the freebsd-hackers
mailing list