2

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.

1 Answer 1

0

To delete an attribute, use the -d flag and the attribute name:

xattr -d com.apple.metadata:kMDItemLastUsedDate myfile

Notice, I am not providing a date ("01/01/2000")

3
  • Hi, yes, I accidentally provided the date... But this code doesn't seem to work consistently. It works sometimes but not others.
    – user278705
    Commented Nov 18, 2020 at 22:51
  • Take a look at this answer (xattr on macOS), specifically the section about multiple versions of xattr. Solutions which are detailed here may help you: stackoverflow.com/a/58616002
    – blong
    Commented Nov 19, 2020 at 4:32
  • I'm getting No such xattr: com.apple.metadata:kMDItemLastUsedDate on Ventura.
    – luckman212
    Commented Dec 27, 2022 at 19:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .