[X-Unix] Re: extract CTIME from the commandline?
Timothy Luoma
lists at tntluoma.com
Sun Aug 21 22:12:48 PDT 2005
Aha... this will only work with Tiger... 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
More information about the X-Unix
mailing list