Results 1 to 4 of 4
Before I use
cp -R * /where want to place/ but I can't find how to use it with (pick all yes) when copy files that already exist.
I find ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-11-2012 #1Just Joined!
- Join Date
- Nov 2012
- Posts
- 4
Where is the difference between this commnads
Before I use
cp -R * /where want to place/ but I can't find how to use it with (pick all yes) when copy files that already exist.
I find this cp -pr and this overwrite my files
Just my question is: Can You tell me where is the difference between recursively copy files and just copy files (speed) or ?
Thank You
- 12-11-2012 #2Linux Newbie
- Join Date
- Dec 2011
- Posts
- 139
cp -R or cp -r recurses through directories. It dives into the subdirs and copies everything in the entire tree branch.
cp -p preserves the datestamps and stuff so the copied files have the same stamps as the originals. I use that all the time.
cp _DOES_NOT_ overwrite files by default unless you use the -f switch. It will ask you everytime.
cp -f will copy and overwrite anything without asking. It's a bit dangerous, so use it with much caution.
Maybe you have an alias 'cp=cp -f'. Try typing 'alias' and see if you have:
alias cp='cp -f'
in there. If so, remove it, pronto. Check in ~/.bashrc, ~/.bash_profile, ~/.profile, that kind of thing. Find out where it's been set.
Also, try 'man cp'. The manual pages are your friends.
- 12-12-2012 #3Just Joined!
- Join Date
- Nov 2012
- Posts
- 4
Thank You and for what is -r then

cp -f back me : cp: omitting directory
cp -pr -f ask me
what to use to work
Thank YOu
- 12-12-2012 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,745
From the cp man page:
Originally Posted by gladiator6
Code:-R, -r, --recursive copy directories recursivelyis "back" a dir? If so, you need "-r" or equivalent.cp -f back me : cp: omitting directory
On your system, it may be that cp is aliased to "cp -i". try this command to see:cp -pr -f ask me
if it returns something like:Code:alias cp
then that is your problem.Code:alias cp='cp -i'
you can always use the full path to the binary to avoid the use of an alias, e.g.:
Code:/bin/cp -f foo bar


Reply With Quote
