>>-lastModified------------------------------------------------>< >>-lastModified=date-------------------------------------------><
Example 5.209. Class FILE - lastModified method
/* On Windows */ say .File~new("C:\Program Files")~lastModified~class -- The DateTime class say .File~new("C:\Program Files")~lastModified -- 2010-11-01T19:14:49.000000 say .File~new("dummy")~lastModified -- The NIL object /* A possible implementation of : touch -c -m -r referenceFile file -c, --no-create do not create any files -m change only the modification time -r, --reference=FILE use this file's time instead of current time */ parse arg referenceFilePath filePath . file = .File~new(filePath) if \ file~exists then return 0 -- OK, not an error referenceFile = .File~new(referenceFilePath) referenceDate = referenceFile~lastModified if referenceDate == .nil then return 1 -- KO file~lastModified = referenceDate return 0 -- OK