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

From Wikibooks, open books for an open world
< Ruby Programming‎ | Reference‎ | Objects‎ | IO‎ | File
Jump to navigation Jump to search

File::Stat[edit | edit source]

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


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

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

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