[X-Unix] Re: extract CTIME from the commandline?
Timothy Luoma
lists at tntluoma.com
Mon Aug 22 11:32:27 PDT 2005
On Aug 22, 2005, at 7:39 AM, Xavier Noria wrote:
> On Aug 22, 2005, at 6:47, Timothy Luoma wrote:
>
> Yes, ctime means (fom stat(2)):
>
> Time when file status was last changed (inode data modification).
> Changed by the chmod(2), chown(2), link(2), mknod(2), rename(2),
> unlink(2), utimes(2) and write(2) system calls.
>
> There is a "B" in the man page of stat(1) that means "birth time of
> the inode", but I get a "bad format" error no matter what I try,
> and this message suggests it is not actually built on OS X:
>
> http://lists.gnu.org/archive/html/bug-coreutils/2004-02/
> msg00070.html
Rats. OTOH, checking the information that stat DOES provide on 3
systems I have access to (FreeBSD 5.x, Gentoo, and OS X) it appears
that the information is never presented the same way across the
different OSes anyway, so it doesn't look like a truly portable
solution is possible. And given that my main need is for OS X...
> Looks like the Foundation framework gives access to the creation
> date since 10.2: the class NSFileManager documents a method to get
> file attributes and among them we have
>
> NSFileCreationDate | NSDate (Available in Mac OS X v10.2 and
> later.)
>
> With the help of people from freenode#macdev I wrote an Objective-C
> program (attached) that prints exactly what you want. To compile it
> (developer tools needed):
>
> gcc -framework Cocoa -o creation_date creation_date.m
>
> It receives a file as argument name and prints its creation date in
> that format:
>
> % ./creation_date foo.rb
> 2005-07-15
Cool! Thanks!!
More information about the X-Unix
mailing list