Ruby/File Directory/atime

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия: Импорт выборки материалов по Ruby)
 

Текущая версия на 17:57, 13 сентября 2010

Checking When a File was Last Used

open("output", "w") { |f| f << "Here"s some output.\n" }
stat = File.stat("output")
stat.mtime            
stat.atime            
sleep(2)
open("output", "a") { |f| f << "Here"s some more output.\n" }
stat = File.stat("output")
stat.mtime            
stat.atime            
 
sleep(2)
open("output") { |f| contents = f.read }
stat = File.stat("output")
stat.mtime            
stat.atime



Get file last accessed time

File::atime( "access.rb" )