Updated 2011-07-03 10:14:20 by dkf
file atime name ?time?

Returns a decimal string giving the time at which file name was last accessed. If time is specified, it is an access time to set for the file. The time is measured in the standard POSIX fashion as seconds from a fixed starting time (often January 1, 1970), suitable for use with clock seconds. If the file doesn't exist or its access time cannot be queried or set then an error is generated. On Windows, FAT file systems do not support access time.

Note that there does not appear to be an interface to ctime - the time the last file attribute change occured. The ctime that is returned by file attributes is not the creation time (at least not on Unix).

The value of ctime is returned by the file stat command. The ctime is not the creation time but the last time one of the values returned by file stat changed (ergo, ctime=change time?). The ctime value can't be edited directly, but editing mtime or atime will change the ctime value.

male 2007-03-15:

Hhm - ctime from the stat array is not the creation time?

The documentation of the Tcl_Stat function from the tcl C API says:
“Tcl_Stat fills the stat structure statPtr with information about the specified file. ... The stat structure includes info regarding device, inode (always 0 on Windows), ..., size, last access time, last modification time, and creation time.”

And I tested this on my system. I used "file stat" with a file on my system and "clock format $stat(ctime)" returned the creation time to be seen in the related Explorer column.

DKF: Ugh, that was a long-standing documentation bug; ctime was always the last metadata change time.

See also edit

[Category Tcl syntax help]Category CommandCategory File