On Thursday 21 of January 2010 23:35:13 Peng Yu wrote:
> Suppose I have directory a and b, the following command will copy the
> content of a to b/a, rather than overwrite the directory 'b' by the
> directory 'a'. I'm wondering if there is an option to overwrite 'b'?
>
> cp -r a b

I don't think something like that is possible with cp itself.  It looks a bit 
dangerous to me anyway.  Instead of that, there is a way to avoid the copy 
operation in such case:

$ cp -r --no-target-directory a b

If you want to destroy content of 'b' and replace with content of 'a', then 
you want to do this:

$ rm -rf b; cp -r --no-target-directory a b

Kamil


Reply via email to