Where does the Finder obtain the “date added” of an item in a folder?

2 Solutions Collect From Internet About “Where does the Finder obtain the “date added” of an item in a folder?”

Yep, the date added could be inferred from other structures. In fact, it resides in Spotlight metadata.

NSDate *dateAdded(NSURL *url)
{
    NSDate *rslt = nil;
    MDItemRef inspectedRef = nil;

    inspectedRef = MDItemCreateWithURL(kCFAllocatorDefault, (CFURLRef)url);
    if (inspectedRef){
        CFTypeRef cfRslt = MDItemCopyAttribute(inspectedRef, (CFStringRef)@"kMDItemDateAdded");
        if (cfRslt) {
            rslt = (NSDate *)cfRslt;
        }
    }
    return rslt;
}

Note: out of date now that Lion’s out.

The Finder isn’t, the Dock is. It tracks this data internally. If you remove a folder and put it back, the “date added” information is lost for existing items.