How could I get a file's "last opened" date ? I know how to get modification date but I didn't find anything on last used or last opened.
I want to arrange my files as in finder.
Thank you for any help ! (sandboxable would be much appreciated)
How could I get a file's "last opened" date ? I know how to get modification date but I didn't find anything on last used or last opened.
I want to arrange my files as in finder.
Thank you for any help ! (sandboxable would be much appreciated)
You need to look at the Spotlight metadata - the field you are interested in is kMDItemLastUsedDate
: http://developer.apple.com/library/mac/#documentation/Carbon/Reference/MDItemRef/Reference/reference.html
If you mean "last accessed" date by "last opened" date, then there's a function in the C standard library for that:
#include <sys/stat.h>
struct stat st;
stat("somefile.ext", &st);
time_t accessed = st.st_atime;