How to copy a folder & preserve the "Date Added" metadata

So I'm copying some stuff from my old MBP (running ML) to my new one (running Mavericks), and I'm trying to find a way to copy certain folders such that the "Date Added" metadata is preserved... I've tried dragging & dropping in Finder and also rsync from within Terminal, but the "Date Added" value always gets set to the current time on the target machine...


Is there any method for doing this?

Posted on Nov 3, 2013 5:50 PM

Reply
11 replies

Nov 3, 2013 6:42 PM in response to mustgroove

I mentioned that 🙂


I'm not sure it is possible. I think the data added is an Apple metadata attribute.


You can try tools like

Chronosync syncs well (just don't know about date added) if you want to tweak folders & exclusions etc, the preview may indicate what will copy.

http://www.econtechnologies.com/


SuperDuper! (designed for bootable backup really, not to easy to configure 'a bunch of folders').

http://www.shirtpocket.com/


CarbonCopyCloner (another bootable backup tool)

http://www.bombich.com/ccc_features.html


FWIW, the 10.9 rsync manual can be read online… https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/rsync.1.html

I think we can write that off ?


The Mac HFS+ tool SetFile doens't seem to offer the option either…

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/SetFile.1.html


I thought they may be extended attributes, but I can't see any mention of date added for items in my downloads folder.


xattr manual

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/xattr.1.html



You can find all the manuals at

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ index.html


I'm afraid that I can't think how to copy it, I would run the rsync via sudo to see if that helps.

Nov 3, 2013 8:40 PM in response to mustgroove

See…

http://apple.stackexchange.com/questions/40941/how-do-so-set-date-added-metadata -in-mac-os-x-10-7-lion


There are some insane solutions to setting date added in there, it turns out it is an extended attribute, but this 10.6 system doesn't have it!


mdls will show it, it is under the key 'kMDItemDateAdded'


Ironically I do remember being OCD about this at one point because I compiled rsync with some extra patches to preserve the xattrs.

Here is what my updated version reports…


/usr/local/bin/rsync --version

rsync version 3.0.7 protocol version 30

Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.

Web site: http://rsync.samba.org/

Capabilities:

64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,

socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,

append, ACLs, xattrs, no iconv, symtimes, file-flags



Here is the version that 10.9 reports…

rsync --version

rsync version 2.6.9 protocol version 29

Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.

<http://rsync.samba.org/>

Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,

inplace, IPv6, 64-bit system inums, 64-bit internal inums


Apple are bad at keeping their installed tools updated - the patches have been around since 10.6, version 3 of rsync is also old now.


I believe I followed this guide by Mike Bombich (he makes CarbonCopyCloner).

http://static.afp548.com/mactips/rsync.html


So I would expect Carbon CopyCloner to preserve them (I think that is what it uses).


If that fails for you I can let you have the shell script that I used to compile it. However it was for 10.6 back in 2012. It does the same as Mike's guide as far as I can remember. You will need Xcode to compile it via the Terminal. It sounds a little extreme for just copying some files 🙂


Does that help?

Nov 6, 2013 5:34 PM in response to mustgroove

I'm not sure that it is, either.


"Date added" is special. I believe it's metadata added by Spotlight when a file is downloaded from an "untrusted" source (i.e. from the web; via Safari, Mail attachment, etc.). This way the first time you try to open this file, Gatekeeper will step in and apply the policies that it has set first. If you say it's OK, then the metadata indicating "Unsafe" and "date added" will be recoreded and you won't have to OK something on subsequent runs.


Gatekeeper and tagged downloads don't come into play on stuff copied over the LAN or other sources, so that _may_ be involved here.

Nov 6, 2013 7:06 PM in response to William Lloyd

The "File was downloaded from…" dialog is when an item is in the QuarantineDB and the metadata is a part of the extended attribute "kMDItemWhereFroms"


Run 'mdls' on any download & you should see the urls.


The xattr -w command should write to the attributes (kMDItemDateAdded), but it simply refuses to update ones controlled by Spotlight…

xattr -w com.apple.metadata:kMDItemDateAdded "2013-11-01 01:02:03 +0000" filename



Depending on how much you care about it there is this Applescript that simply "date-hack's" the file to the correct values.

http://apple.stackexchange.com/questions/40941/how-do-so-set-date-added-metadata -in-mac-os-x-10-7-lion


If it's just sorting that annoys you can perform the copy with the destination volume in the privacy section of Spotlight prefs, it means the date added will be blank instead of the current time, just re-enable after completion, it seems to remain blank (but my index isn't rebuilt yet).


My guess is that Spotlight & fsevents need to be stopped from seeing the file being added.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to copy a folder & preserve the "Date Added" metadata

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.