You can find the last accessed date of a file in ruby by using the File::Stat
class. Here's an example:
main.rb147 chars5 lines
The File.stat
method returns a File::Stat
object which contains information about the file. The atime
method of this object returns the last access time of the file. You can use the strftime
method to format the date and time as needed.
gistlibby LogSnag