Results 1 to 5 of 5
Hi all
I need to copy a folder and its contents, automatically overwriting the existing folder if it exists.
I can get the folder to copy e.g:
cp -r /a/b/ ...
- 10-22-2008 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 10
copy folder contents without overwrite prompt
Hi all
I need to copy a folder and its contents, automatically overwriting the existing folder if it exists.
I can get the folder to copy e.g:
cp -r /a/b/ /c/
but the second time i run the command it asks for confirmation:
[root@SK-DB-CA-T /]# cp -r /c/b/ /a/
cp: overwrite `/a/b/aaa.txt'? n
cp: overwrite `/a/b/aaa.txt~'? n
how do i stop it from doing so?
- 10-22-2008 #2Just Joined!
- Join Date
- Oct 2008
- Posts
- 21
use
cp -Rf /c/b /a/
- 10-22-2008 #3Just Joined!
- Join Date
- Sep 2008
- Posts
- 10
Hi
nope it does not work
[root@SK-DB-CA-T /]# cp -Rf /c/b /a/
cp: overwrite `/a/b/aaa.txt'? n
cp: overwrite `/a/b/aaa.txt~'? n
and i am using a stock standard red hat 5 installation, if that matters
- 10-23-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Feed it using the "yes" command.
If confirmation is needed, "yes" will be assumed as the answer and cp will continue.Code:yes | cp <whatever>
- 10-23-2008 #5
Maybe Red Hat has `cp -i` as a default option to ls?
You can probably see by typing
What happens when you do /bin/ls -r dir blabla, does that do it non-interactively?Code:echo $LS_OPTIONS
Can't tell an OS by it's GUI


Reply With Quote