RosettaCodeData/Task/File-modification-time/Ruby/file-modification-time.rb
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

11 lines
302 B
Ruby

#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')