I am trying to change the "date last opened" attribute for several files and folders on El Capitan. The old technique of using "touch -mt " doesn't seem to work. Sometimes it works in very rare cases but for most of my files the command terminates with no errors and no effect on the "date last opened" attribute. It does seem to change the "date modified" attribute. Any ideas?
1 Answer
I believe the following should work, I could not confirm it, yet:
The last opened date is stored in the metadata kMDItemLastUsedDate
property. You can check it using the mdls <file>
command.
To modify the value use the following syntax:
xattr -w "com.apple.metadata:kMDItemLastUsedDate" "<date>" <file>
-
I tested it. it doesn't seem to work. I think the issue might have something to do with the date string. I did find this discussion: apple.stackexchange.com/questions/40941/… Commented Sep 7, 2016 at 4:31