Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Extract CTIME in zsh 4.2.3?



    Hi Shawn and Timothy :)

 * Shawn Halpenny <paxunix@xxxxxxxxx> dixit:
> On 8/22/05, Timothy Luoma <lists@xxxxxxxxxxxx> wrote:
> > I've found a solution, but this will only work with Tiger (Mac OS X
> > version 10.4.x)...
> Ahh, it wasn't clear you wanted the create-time.  In Unix (and any
> sufficiently Unix-like operating system) the "ctime" for a file is the
> last time there was a change to the file's inode and is generally
> portable.  Not all Unixes keep track of the create-time for a file, so
> any mechanism to retrieve it is almost certainly non-portable.

    In fact, it is not present in SUS. Probably it is present only
for a few filesystems, so it has to be retrieved in a non-portable
way. Under Linux, I don't recall now of any filesystem that
implements creation time for entries. It's not an operating system
problem, is a filesystem problem. Even in the case you can write
code for some UNIX flavour to retrieve that data, it will only work
for some particular filesystem. The VFS on top of that will only
store the st_atime, st_mtime and st_ctime values in the metadata.

    Another solution will be to create a dotfile or something like
that when creating the file whose creation date you want to obtain,
and make sure the file contents of that dotfile (or associated file,
whatever you call it) doesn't change. Then the st_mtime of the
associated file will be the creation time of the 'real' file. Not a
very clean solution, but...

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...



Messages sorted by: Reverse Date, Date, Thread, Author