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

12 lines
302 B
Ruby
Raw Permalink Normal View History

2023-07-01 11:58:00 -04: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')