From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 29 10:49:59 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D4E4816A4E0 for ; Tue, 29 Aug 2006 10:49:59 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C11943D55 for ; Tue, 29 Aug 2006 10:49:58 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (jqdovs@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k7TAnjsc009696; Tue, 29 Aug 2006 12:49:51 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k7TAnf1h009695; Tue, 29 Aug 2006 12:49:41 +0200 (CEST) (envelope-from olli) Date: Tue, 29 Aug 2006 12:49:41 +0200 (CEST) Message-Id: <200608291049.k7TAnf1h009695@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@freebsd.org, rick-freebsd@kiwi-computer.com, mlobo@digiart.art.br, rcoleman@criticalmagic.com In-Reply-To: <44F3D17E.6050405@criticalmagic.com> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Tue, 29 Aug 2006 12:49:51 +0200 (CEST) Cc: Subject: Re: A handy utility (at least for me) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@freebsd.org, rick-freebsd@kiwi-computer.com, mlobo@digiart.art.br, rcoleman@criticalmagic.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Aug 2006 10:49:59 -0000 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