From: David Brady Date: 2005-09-06T06:52:38+09:00 Subject: Re: Help me clean up this method Simon Kr�ger wrote: > David Brady wrote: > >> If you have links, you also have du, which IMO is the Right Tool For >> This Job: >> >> total = `du --max-depth=0|cut -f 1`.to_i > > > sorry for stating the obvious, but: this isn't very portable. Yup! :-) Portability isn't a good idea here. (wait for scandalized gasps to quiet down) The need here was to clean up the code. The solutions so far have bulkily danced around the fact that Find::find doesn't seem to work satisfactorily. If the Standard Library is defective, the proper, *portable* solution should be to patch the .c files that are defective. Until then, if we're going to work around the Standard Library, we should be as quick and deadly as possible. I recognize that it may be seen as cheating or possibly even inappropriate to suggest "don't use Ruby for this" on a Ruby mailing list, but I feel strongly that Ruby's very ability to take advantage of external tools is a great strength of the language. A superior wheel already exists; reinventing it poorly does not seem to me to leverage Ruby's power very well. There seems to me to be a "right" way to do this, and it is to have the Standard Library work as desired. Until then, how much effort should be spent standardizing on a portable kludge? And of course, if the OP is on a different platform, the if statement that started my earlier post will become important. The else clause probably reads "then the issues with File::find link don't affect you. Use the Standard Library." Just my $0.02. Note sig. -dB -- David Brady ruby-talk@shinybit.com C++ Guru. Ruby nuby. Apply salt as needed.