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

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

First create a file, and then call the stat method on it. Use the methods of stat to obtain information about the file.

Example:

if File.new('/etc').stat.directory?
      puts '/etc is a directory'
end