From: Massimiliano Mirra Date: 2002-01-13T02:43:33+09:00 Subject: Re: Dir.entries have no home On Sat, Jan 12, 2002 at 04:44:42AM +0900, Ron Jeffries wrote: > I'd like to be able to ask questions of directory entries, like are > you a directory, what is your last-written date, and so on. Does this help you? Should be pretty portable, too. class FileDesc def initialize(location, name) @location, @name, @path = location, name, File.join(location, name) @stat = File.stat(@path) end attr_reader :location, :name, :path, :stat def method_missing(method_id, *args, &block) if @stat.respond_to? method_id @stat.send(method_id, *args, &block) else super end end def to_s @path end end class XDir def XDir.entries(dir) dir = File.expand_path(dir) Dir.entries(dir).collect {|name| FileDesc.new(dir, name)} end end XDir.entries('.').each do |file| puts "#{file.path}\t#{file.ctime}\t#{file.ino}" end Massimiliano