I am trying to clear this extended attribute for all the files located in the Recents smart folder. They are ordered by the "date last opened" attribute. I am trying to clear this attribute so that the files no longer show in recents.
So far I have been able to set the date using
xattr -w "com.apple.metadata:kMDItemLastUsedDate" "01/01/2000" my file
This worked once and is no longer working.
Additionally I used
xattr -d "com.apple.metadata:kMDItemLastUsedDate" "01/01/2000" myfile
This worked! But just once for one file. Strangely it does not seem to be working any more.