Hi everyone, I’m having some troubles getting the last used date of a file, can anyone see issues here with my code?
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:anObject error:NULL]; if (fileAttributes != nil) { MDItemRef item = MDItemCreate(NULL, (CFStringRef)anObject); NSDate *aDate = (NSDate*)CFBridgingRelease(MDItemCopyAttribute(item, kMDItemLastUsedDate)); if (!aDate) { NSDate *fileCreateDate = [fileAttributes objectForKey:NSFileModificationDate]; } } My problem is I’m only getting a kMDItemLastUsedDate on about 10% of files I check, and even though I always get a value for NSFileModificationDate it still doesn’t seem to always be the true last used date. For example looking at how Path Finder does it they have an Attribute tag that seems to more correctly give the last date file was used. Any input here would be appreciated thanks in advance... _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com