What's the difference between copying a file and duplicating it in Mac OS X 10.3? Also, what does the terminal command "ditto" do? As far as I can tell, the only difference is in setting permissions?

Hi there, By the way great site... well, as far as i know there is no difference between the methods of copying, except the clipboard gets used?. Anyhow, for the lowdown on"ditto", check out this link:

http://www.bombich.com/mactips/image.html

And by the way, it is awesome to see programmers using Macs... Sweet!.

:cheesy:

Hey there. Thanks for the info. Here's why I am asking that question. I just partitioned my system drive to put my user folder on its own partition. When I right clicked and chose Copy to copy the folder onto the new partition, all the permissions got screwed up. (i.e. it changed the user/group of every file, etc.) When I right clicked and chose Duplicate, its copy seemed to be more precise as far as permissions went? Needless to say, "copying" screwed everything up because my user lost privileges to my own home directory!

Thanks for the link, I'll go take a look now. And thanks for the comments about the site :)

I just read the article you posted and I see that the command is

sudo ditto -rsrcFork

When I just copied my user directory, I used

sudo ditto -rsrc

as that is the command I found on some website. Would you know the difference by any chance?

The website you just sent me a link to says -rsrcFork is to preserve Resource Forks ?? But then what is -rsrc for?

Bummer on the copy biz, I normally back up 2 dvd then, do a fresh install. I hate getting ghosting/overwrites. It is best to start fresh, partition with zeros, then reinstall, but nevermind.
If your permissionsa are stuffed, go to, applications/utilities/disk utilities/ click on your drive, then select verify permissions, this will take a few minutes, then it will tell you all the permission problems. then simply click fix.

but if you already knew this then i will be quiet heh heh.

And yes, i 2 have mac envy.. I only have a g4, and dont yet have The lastest os... but soon =)

No, sorry, i am not too conversant with the command line.

But I will be poisting & viewing more to find out. =)

i am a designer foremost, learning programming as i go, so sorry, wish i could help...

Thats okay. Thanks for the link :) and enjoy your stay!

I found a website that answered a lot of my questions - including the differences between cp and ditto and what -rsrcFork means. Unfortunately it looks as if I should have used -rsrcFork instead of -rsrc

I did a bit more research and am even more confused. I found mention that, while the standard command to use is ditto -rsrcFork, there is only mention of rsrc in the ditto help. Not only that, but when you type ditto /h you are told that the correct command is --rsrc and not -rsrc

way over my head, lol.. BTW, how are you finding the New 'Panther' ?, I look forward to getting it soon.
the command line is number 1 reason i am a designer. =)

I am not a normal member of this site. I was just looking through Google to find the answer to another problem and came across you guys who had a question that needed answering. I have just joined for the purpose of answering this one question for you guys, and will probably not come back.

Anyway:
First of all, let me clear up the "--rsrcFork" confusion. "--rsrcFork" IS "--rsrc". They do the exact same thing. They are "aliases" of each other.

As for "-rsrc" vs "--rsrc" (with the 2 dashes), "--rsrc" is considered more proper. I have not tested if 1 dash will work, but I KNOW 2 dashes will. And 2 dashes is considered to be the standard for command line options in *NIX and its variants.

As for what ditto does, let me try to keep it simple:
It copies files+folders from one place to another.
The difference between "ditto" and "cp" is that ditto will preserve a part of a file called the "resource fork". This is very important for some files, so it is usually better to use ditto when copying anything important.
Also, ditto can be used to make and extract to/from archives using the -c (possibly together with -z for better compression) and -x options. This is what I usually use when backing up data.

As for what 72dpi said about repairing permissions, you were wrong (no offense). This will not fix any permissions in your copies. It is almost an ucban myth that repairing permissions really solves much of anything. The only time it is sometimes useful is if you were tinkering around by CHANGING system files. Even then, it is more likely to hurt than to help. (although it might be a godd idea to repair permissions after doing a major OS upgrade -- like from Panter to Tiger).

Also, just a little reccomendation for anyone who is interested in learning more about the BASH shell (also known as Terminal):
"man" is your friend. Just about every command available has a "man" page. You can access it by tying in:
man "Command_Name"
For example, to see the man page for ditto, type in:
man ditto
You can learn a lot from man pages, and they are often the most reliable place to look for documentation. Keep in mind, though, that a lot of things in these man pages may be confusing for an inexperienced user.
If you look in the man page for ditto, you will notice that "--rsrcFork" is not listed (Unless you are running 10.0 or 10.1). man pages almost always include all of the options for a command (at least, they are supposed to). "--rsrcFork" is not listed because it is no longer an official option.

By the way, some "elitist" UNIX gurus will often respond to most questions with "RTFM", which means "Read the F---ING man". This is often sound advice, although I prefer not to say it that way.

If anyone has any further questions, feel free to e-mail me.


~Matt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.