[Eclug] File creation times

  • Previous message: [Eclug] File creation times
  • Next message: [Eclug] File creation times
  • James Antill james-eclug at and.org
    Tue Aug 15 00:23:53 EDT 2006

     

    David Krings <david.krings at snet.net> writes:
    
    > Hi,
    >
    > 	while working on a better script for displaying my tons of
    > pictures and home videos on my cheesy website I came across some
    > oddity that requires some geek (means ECLUG) input. It appears as that
    > the original creation time of a file is not stored, only the time the
    > file was last changed / modified and last accessed. Is it correct,
    > that file systems do not store the creation time? Why would one not
    > store the creation time?
    
     Short answer:
    
     Because god knows how many years ago creation timestamp wasn't in the
    stat struct but change time was ... and no one has update the
    definition of struct stat (and all the programs).
    
     Longer answer:
    
     Storing this as a file attribute is not a simple problem, for
    instance if you move to a bigger disk and rsync everything over you
    almost certainly don't want the creation time to now be "creation
    time, or when I moved stuff to my new HD".
     But in the same vein if it's arbitrary data ... you might as well
    store it somewhere else, like inside the file itself (or an extended
    attribute).
    
     For instance with digital photos there is probably creation time in
    the photo itself:
    
    % exiftime -t ~/pics/Public/Cats/Catzilla/catzilla\ brave.jpg
    Image Created: 2002:06:19 21:54:03
    % stat --printf 'mtime: %y\nctime: %z\n' ~/pics/Public/Cats/Catzilla/catzilla.jpg
    mtime: 2002-07-29 19:33:24.000000000 -0400
    ctime: 2006-06-09 17:08:15.000000000 -0400
    
    > Using PHP,  filectime gives me the changed time whereas filemtime
    > gives the file modified time. So, what is the difference between
    > changed and modified? Is that a difference that applies only to *n*x
    > systems?
    
    http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_07
    
     The simple rule of thumb is that if you are altering the data, mtime
    is updated but if you are altering the metadata ctime is updated
    (note that making the file bigger does both, as it's size changes).
    
    -- 
    James Antill -- james at and.org
    http://www.and.org/and-httpd
    
    

     

     

    More information about the ECLUG mailing list