Re: First timer: Finder Copy vs. cp
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Aug 7, 2006, at 2:01 PM, Jeffrey Ellis wrote: Hi-- Sorry for the n00b-ness of this question. "man cp". If you're interested in a copy of the article, email me privately. Wow... I saw a list of everything cp does, and you're right. It looks like it does everything. Okay, so I guess this is my next question. If cp does everything, why would anyone use ditto? I always thought that was used because of it's ability to copy resource forks. -dhan ------------------------------------------------------------------------ Dan Shoop AIM: iWiring Systems & Networks Architect http://www.ustsvs.com/ shoop@iwiring.net http://www.iwiring.net/ 1-714-363-1174 pgp key fingerprint: FAC0 9434 B5A5 24A8 D0AF 12B1 7840 3BE7 3736 DE0B iWiring provides systems and networks support for Mac OS X, unix, and Open Source application technologies at affordable rates. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... At 12:42 PM -0700 8/9/06, Terry Lambert wrote: If the Finder is based on Darwin, why are there no direct commands which will replicate a Finder Copy, i.e., copy all the metadata for a given file, not just it's resource forks as in ditto or rsync? I guess basically, the question from a programming standpoint, is there a way to replicate a Finder Copy without actually calling the UI? Thanks :) The short answer is that the command line utility "cp" will copy the metadata by default unless you tell it not to by specifying "-X" as one of the arguments. So the support is already there, and on by default. If the metadata in question includes ACLs, then you will want to specify "-p" to "preserve attributes" - primarily, protections and timestamps - of which ACLs are a subset. cp does not duplicate the behavior of the Finder, nor does ditto. There are no shell commands I'm aware of that accurately duplicates its behavior. (Which is a huge shame.) One telling issue is that the Finder properly preserves Creation Date, while command line tools do not. The BSD behavior for creation dates is to munge it with modified date, even when creating what are arguably not Apple Doubles (since the Apple Double spec says that this metadata should be preserved in the Apple Double) either explicitly based on their necessity due to foreign file systems or even 'internally' when copying to HFS based volumes. :Shameless Plug: See this month's issue of MacTech for a further analysis and discussion. I believe there are copies available at the WWDC, if you're there. See http://iwiring.net:8000/papers/Who_Copies_What.pdf for a summary of how tools compare, from this article. At 4:16 PM -0700 8/9/06, Jeffrey Ellis wrote: Because ditto and cp copy different metadata. For instance ditto doesn't copy BSD flags while cp can. (The Finder only copies one BSD flag, uchg) Bottom line if you want the behavior of the Finder you need to use the Finder. Neither ditto, cp, tar, rsync or other tools handle metadata in the exact same manner. -- This email sent to site_archiver@lists.apple.com
participants (1)
-
Dan Shoop