[R] Does file.info man page describe ctime corrrectly?

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 19 10:47:30 CET 2008


This really is a topic for R-devel ... see the posting guide.

On Fri, 19 Dec 2008, Graham Williams wrote:

> (R 2.8.0 on Debian GNU/Linux sid)
>
> ?file.info contains:
>
> mtime, ctime, atime: integer of class '"POSIXct"': file modification,
>          creation and last access times.
>
> This implies that ctime is "file [...] creation [...] time"
>
> Has R implemented ctime differently to Unix?
>
> I understand, on Linux at least, that ctime is the last change time
> (not the creation time). See "man ls" which says:
>
>       -c [...] ctime (time of last modification of file status
>        information) [...]

'man stat' would be more definitive, and

http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_07

even more so (but only for POSIX-compliant OSes).  As you will see, there 
is considerable room for interpretation even under POSIX.

> However, testing seems to indicate file.info is returning the change
> time, not creation time (I'm not sure we can actually determine
> creation time of a file on Linux).
>
> Perhaps just a file.info documentation slip?

Well, to call it 'last change' would indeed be a documentation slip. 
What it does depends on the OS and file system, but on Linux it is the 
last *status* change, which is often the creation time (modifying the file 
does not necessarily change the status).  On Windows it *is* the creation 
time, and that means it is too on a SMB-mounted Windows file system on 
Linux.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list