Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vaalbara

macrumors member
Original poster
Apr 5, 2022
60
8
I'm trying to save space by moving the mess inside the Downloads folder to an external disk (using rsync -avAX).

Is there any way to preserve the "Date Added" attribute of a file?
 
t option I think will work.

However, rsync is a bit of overkill if doing simple copy then clear the Downloads folder. cp command with -p option handles preserving timestamps.
 
Is there any way to preserve the "Date Added" attribute of a file?
No, to the best of my knowledge. "Date Added" is not really an attribute of a file. Better to think of it as a multi-valued attribute of the folder which will exists for each file in the folder. This is because a file could be added to multiple folders (using hard links) and the "Date Added" should be specific to each folder.
cp command with -p option handles preserving timestamps.
Correct me if I am wrong, but I believe cp -p only preserves time stamp attributes that belong to the file (dates created and modified)

Edit:
Date added is file metadata held by the file system and created whenever a file is added to a folder. It is not a file attribute or even extended attribute which can (in most cases) be moved with the file.

If you are really determined see this posting https://apple.stackexchange.com/questions/40941/how-to-set-date-added-metadata-in-mac-os-x-10-7-lion where an AppleScript is used which for each file gets the file date added, modifies the system time (Yes, you read that right), copies the file and finally resets the time from the network. I DO NOT RECOMMEND THIS! I am not even sure it works with recent version of macOS.
 
Last edited:
Date added is file metadata held by the file system and created whenever a file is added to a folder. It is not a file attribute or even extended attribute which can (in most cases) be moved with the file.
Thanks for the detailed answer and the SO link. I've just run mdls on a random file as suggested there to see the kMDItemDateAdded info for the file. Sad to see that it requires an awful hack to preserve these.

It seems all I can do right now is to export these to a text file using a simple for loop and mdls. That may be enough for future reference.
Thanks again.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.