Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

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

add comment

4 Answers 4

up vote 3 down vote accepted

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...

share|improve this answer
add comment

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/
share|improve this answer
2  
Or escape the command \cp -fr ... –  mpez0 May 5 '10 at 13:43
add comment

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.

share|improve this answer
add comment

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.

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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