On May 22, 2010, at 10:33 AM, Angelo Chen wrote:

> I'd like to get creation date of a file, here are the codes:

Since there seems to be a bug with Cocoa (that you should file at 
<http://bugreport.apple.com>), you may wish to try stat(2) or perhaps 
FSGetCatalogInfo().

For stat(2), if you're targeting pre-Snow Leopard, make sure to define 
_DARWIN_USE_64_BIT_INODE before including the headers so the stat structure 
will have the st_birthtimespec field.

Also be aware that not all file systems support the notion of creation dates of 
their objects.  I don't know off-hand if NTFS does.  You can use getattrlist(2) 
to check.  (Come to think of it, you can use getattrlist() to obtain the file 
creation date, too, although stat() is much simpler.)

You can avoid writing a lot of experimental test code yourself by downloading 
and using Apple's FSMegaInfo sample tool.  Apply that and its various 
sub-commands to see what results you get from an NTFS volume.
<http://developer.apple.com/mac/library/samplecode/FSMegaInfo/>

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to