In my opinion, Pathname much better for file names than simple strings.
require "pathname" Pathname.new(directory_name).children.select { |c| c.directory? }
This gives you an array of all the directories in this directory as Pathname objects.
If you want to have lines
Pathname.new(directory_name).children.select { |c| c.directory? }.collect { |p| p.to_s }
If directory_name was absolute, these lines are also absolute.
johannes Dec 14 '09 at 9:27 2009-12-14 09:27
source share