You can use the File class in Ruby to get the last modified date of a file. Here's an example of how to get the last modified date of a CSV file:
main.rb132 chars8 linesIn this example, we first require the csv and date libraries. We then specify the name of the file we want to get the last modified date of (example.csv) and use the File.mtime method to get the last modified date.
Finally, we print out the last modified date using puts. Note that the File.mtime method returns a Time object, which we can format however we like using the strftime method.
gistlibby LogSnag