[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01791] Re: size of Dir stream

From: Dave Thomas <Dave@...>
Date: 2000-03-09 14:19:34 UTC
List: ruby-talk #1791
The following message is a courtesy copy of an article
that has been posted to comp.lang.misc as well.

"J.B. Huijsmans" <j.b.huijsmans@chem.rug.nl> writes:

> I've been trying to make a procedure to remove a directory tree. I found
> that if I use :
> 
> files=Dir.open(path)
> if files.size<=2 # only `.' and '..'
>     files.close()
>     Dir.delete(path)
> else
>     ...
> end

The class method Dir.open returns a Dir object, which (unless things
have changed in 1.5) does not respond to 'size'.  Possibly you wanted
to use Dir.entries, which returns an array of file names.


Regards


Dave

In This Thread