Re: A handy utility (at least for me)



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
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: A handy utility (at least for me)
    ... The following is probably the most efficient solution. ... an arbitrary numebr of subdirectories). ... Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing ... Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd ...
    (freebsd-hackers)
  • Re: problem setting user and group on mounting a cifs share - Please help
    ... Tanks for any suggestion, ... when you umount and mount the share, do the logs in /var/log say ... Do the same happen when mounting shares from other machines? ... on one machine it works fine, uid and gid of the share and all subdirectories are set correctly, on the other the result is as I posted i.e. ...
    (Debian-User)