currently there's a xxx dir already in /home/yyy
I'm trying to overwrite it cp -fr ../xxx /home/yyy/
doesn't work still prompts me to overwrite the individual files. how do I fix it?

link|improve this question

25% accept rate
feedback

migrated from stackoverflow.com May 5 '10 at 11:16

This question came from our site for professional and enthusiast programmers.

4 Answers

or, to circumvent the problem with aliases in the first place, call the cp binary directly. Mostly, this will work:

/bin/cp -fr .../xxx /home/yyy/
link|improve this answer
2  
Or escape the command \cp -fr ... – mpez0 May 5 '10 at 13:43
feedback

Indeed, see if it's aliased. You can do this by typing alias cp. If it's in that list you can remove it by typing unalias. (The default) -i option will be gone too.

Overwriting won't be a problem anymore...

link|improve this answer
feedback

I'll assume you are using BASH or SH as your shell, in which case you can explicitly undo all aliases by prefixing your command line with command. E.g.

command cp -fr ../xxx /home/yyy/

Which would ignore any aliases for cp and any shell-function called cp.

link|improve this answer
feedback

Looking here

-i is ‘interactive’ aka ALWAYS PROMPT, and evidently overrides -f

Make sure your cp is not aliased or something. (run type cp ). As a simple example, the order of the options is important. For instance rm -if f will say nothing. rm -fi f will prompt me before removing f.

link|improve this answer
if it's aliased, AFAIK his input should override the alias, because it will be something like cp -i -fr etc. – Lohoris May 5 '10 at 11:23
@Lo'oris: On my system (RHEL 5), the -i overrides the -f. – GreenMatt May 5 '10 at 13:45
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.