RosettaCodeData/Task/File-modification-time/Ruby/file-modification-time.rb

12 lines
302 B
Ruby
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
#Get modification time:
modtime = File.mtime('filename')
#Set the access and modification times:
File.utime(actime, mtime, 'path')
#Set just the modification time:
File.utime(File.atime('path'), mtime, 'path')
#Set the access and modification times to the current time:
File.utime(nil, nil, 'path')