I have been using Terminal to change the "date added" attribute of a file without success.
What I'm doing is:
Display the attributes of a file:
mdls file_name
Display the "date added" attribute:
xattr -p "kMDItemDateAdded" file_name
Change it:
sudo xattr -w "kMDItemDateAdded" "201111111111.11" file_name
The third instruction does not work! Whereas touching the file with the same date value DOES change date modified.
I'm running Yosemite. Any ideas from the community?
Thanks to Ken Thomases above for pointing me in the direction of
setattrlist; the following code works for me on macOS Monterey 12.5.1.