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

mrnabo

macrumors newbie
Original poster
Aug 24, 2008
12
0
Hi,

Just wondering if using the Terminal command 'cp -R <new dir> <old dir>' actually replaces the contents of the folder entirely, or whether it just merges the content leaving older files and folders with the same name untouched?

Let me know if I need to be clearer,

Thanks
 
This command will:
copy all files from "<new dir>" into "<old dir>". If "<old dir>" contains a file with the same name as in "<new dir>", the file in "<old dir>" will be replaced with the one from "<new dir>". If you don't want this, use the "-n" switch, if you want to decide which file to keep, use the "-i" switch, eg.
Code:
cp -Ri <source dir> <target dir>
 
Thanks for clearing that up for me fwhh,

So, i'm assuming that

Code:
cp -Rn <source dir> <target dir>

Will leave same name files in the target directory?

Is there a good place to learn about the Terminal, it's commands and uses? I'm interested in learning the next steps and getting my hands a bit more dirty with UNIX.

Thanks
 
The $15 book "Linux Phrasebook" by Scott Granneman really helped me out. Has plenty examples of commonly used commands.

HTH,
Troy
 
So, i'm assuming that

Code:
cp -Rn <source dir> <target dir>

Will leave same name files in the target directory?
Yes, it will.
If you are unsure of a command, in most cases you can type eg.
Code:
man cp
which will give you the manual page for "cp". In man pages you can search with the command
Code:
/<text to search>
and repeat the search by pressing "n". Leave the man page by pressing "q".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.