On 18/06/06, Timothy Hunter <TimHunter / nc.rr.com> wrote:
> Gareth Clews wrote:
> >  3. An easier one methinks, how do I get irb to put what the contents of
> > a folder are and whether they are folders or files? (again kind of like
> > ls in bash)
> >
> Easy way: system("ls").
>
> Harder way, use the Dir class or the Find module. Dir is one of the core
> classes. Find isn't, but it is part of the standard library so all you
> have to do to use it is execute
...

Here's a fairly easy way that doesn't need anything from the standard library:

Dir['*'].each do |entry|
  puts "#{entry}#{File.directory?(entry) ? '/' : ''}"
end

Paul.