[#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:01788] size of Dir stream

From: "J.B. Huijsmans" <j.b.huijsmans@...>
Date: 2000-03-09 11:57:30 UTC
List: ruby-talk #1788
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

files.size is zero although when I print files.each it shows all files and
directories.
I solved it by using:

files=[]
Dir.foreach(path){|file| files.push(file)}

I was wondering is this normal behaviour?

Jasper

In This Thread

Prev Next