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

Re: Extract CTIME in zsh 4.2.3?



I've found a solution, but this will only work with Tiger (Mac OS X version 10.4.x)...

http://developer.apple.com/macosx/spotlight.html

kMDItemFSCreationDate            The date an item's file was created.

kMDItemContentCreationDate    The date an item's content was created.

The first tells you when the file was first created. The second tells you when content was added to it (this is probably identical in most circumstances)

This is how you get to it:

$  mdls FILENAME |\
    grep "^kMDItemContentCreationDate"

kMDItemContentCreationDate      = 2005-08-20 00:47:41 -0400


    And this is how I'd get just the date:

$  mdls FILENAME |\
    awk -F" " '/kMDItemFSCreationDate/{print $3}'

 2005-08-20

If there's a more portable way to get this to work, I'd like to learn about it, but this will work for now.

TjL



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