Re: A handy utility (at least for me)
- From: "Rick C. Petty" <rick-freebsd@xxxxxxxxxxxxxxxxx>
- Date: Mon, 28 Aug 2006 11:42:18 -0500
On Mon, Aug 28, 2006 at 06:18:58PM +0200, Oliver Fromme wrote:
Rick C. Petty wrote:
>
> I find that the following command works just fine for me:
>
> find /usr/ports -type d -name work -prune -print -delete
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
You might as well just do:
rm -rf /usr/ports/*/*/work
because using xargs doesn't gain you anything in this case. How does your
example work with an arbitrary number of subdirectories?
Your example does't work if the number of work directories exceeds the
maximum number of arguments (4096 IIRC), which can happen amidst 16,000
ports. This bit me once so I use find now (granted this was before I was
using portupgrade).
Also I don't see how your example is any more efficient than find-- you're
just making the shell do the work instead of find. In either case, it's
just a sequence of opendir()/readdir(). In fact your example would start
secondary processes to do the directory removal; find has this built in
and thus doesn't have the overhead of process forking. Perhaps if on an
arbitrary directory tree, find may not be as efficient, but the only
directories deeper than depth of two (in my example) are work directories,
and they would be pruned.
-- Rick C. Petty
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: A handy utility (at least for me)
- From: Mike Meyer
- Re: A handy utility (at least for me)
- References:
- Re: A handy utility (at least for me)
- From: Rick C. Petty
- Re: A handy utility (at least for me)
- From: Oliver Fromme
- Re: A handy utility (at least for me)
- Prev by Date: Re: jails, cron and sendmail
- Next by Date: Re: A handy utility (at least for me)
- Previous by thread: Re: A handy utility (at least for me)
- Next by thread: Re: A handy utility (at least for me)
- Index(es):
Relevant Pages
|
|