I am working on a script to rename files after a formula (discussed here: http://www.drbunsen.org/naming-and-searching-files-part-1/ ) . The formula calls for an ID string that is constructed from the date and time the file is created, of the format YYYMMDD_HHMMSS. The closest approximation of the file creation date that I can find thus far is the inode change time returned by the stat() function. I was under the impression that this would not be too far off from the first save date, but from what I later read and my experimentation, it seems VERY far off the vast majority of the time. The inode change time is more often than not exactly the same as the last modification time, and even when it's not it's nowhere close to the actual date/time of the first time the file was saved.
The ID string here serves two purposes: to make a unique identifier, and to put the files in order by creation date and time. At the very least I figure using the inode change time should produce unique identifiers, but I would like to have chronological order if possible. Unfortunately, I am starting to believe that this is not possible. I have files going back to the mid 1990's, coming from various versions of Windows, as well as files produced over the last few years natively on the Mac. Even the creation dates/times of the native Mac files, as listed in the finder, seem radically incorrect.
Does anyone know if this is possible? Or should I just accept the fact that all dates before 8/2013 are suspect?