Ruby Programming/Reference/Objects/IO/File/File::Stat

< Ruby Programming‎ | Reference‎ | Objects‎ | IO‎ | File

File::StatEdit

A File::Stat object is one that contains a file's status information.

Example:

stat = File.stat('/etc') # a File::Stat object
if stat.directory?
  puts '/etc is a directory last modified at ' + stat.mtime.to_s
end

You can also get a stat object for open file descriptors.

a = File.open('some file')
a.stat # File::Stat object