Is it possible to get the last access date of a file / folder in mac using cocoa?
struct stat output; //int ret = stat([[[openPanel filenames] lastObject] UTF8String], &output); int ret = stat([[[openPanel filenames] lastObject] fileSystemRepresentation], &output); // error handling omitted for this example struct timespec accessTime = output.st_atimespec; NSDate *aDate = [NSDate dateWithTimeIntervalSince1970:accessTime.tv_sec]; NSLog(@"Access Time %d, %@",ret, aDate);
According to the code above, I tried both UTF8String and fileSystemRepresentation, but both give me the current date and time. Please let me know if I am doing something wrong.
objective-c cocoa
Ammitri
source share