Well I found this:
The value of attributes changed by command xattr is independent of the values displayed by the mdls
When I did this in a text file:
mdls -name kMDItemLastUsedDate /Users/StormXeron/Desktop/commands\ copy.txt
the stored date in kMDItemLastUsedDate was displayed as:
Then I use xattr write function as suggested by you as
xattr -w com.apple.metadata:kMDItemLastUsedDate "2016-01-01 12:34:56 +0000" /Users/StormXeron/Desktop/commands\ copy.txt
xattr -w kMDItemLastUsedDate "2016-01-01 12:34:56 +0000" /Users/StormXeron/Desktop/commands\ copy.txt
Now here I found a difference:
I. With mdls results:(Unchanged output)
Input:
mdls -name kMDItemLastUsedDate /Users/StormXeron/Desktop/commands\ copy.txt
Output:
2. With xattr -l the results were
Input:
xattr -l /Users/StormXeron/Desktop/commands\ copy.txt
Output:
Conclusion:
1.The attributes displayed by 'mdls' command is unchangable because the source of the values taken by those attributes are different so I cannot find it.
2. Interestingly, the xattr -w creates new attribute and then sets its value.
3. I can't find the command to change the attributes displayed by mdls. (this is what I need)đ