mv directory to overwrite another

Posted by gbjbaanb on Server Fault See other posts from Server Fault or by gbjbaanb
Published on 2010-05-12T18:56:16Z Indexed on 2010/05/12 19:04 UTC
Read the original article Hit count: 313

Filed under:
|
|

I may be going bonkers here, but I'm trying to move a directory to a new location, overwriting the contents (on Linux, using bash).

Everytime I try it, it responds with "mv: cannot move `./src' to a subdirectory of itself"

eg. I have:

/src
/new/dir/src
/$ mv src/ new/dir/

If I delete the destination dir, then it works. I know I can move the contents of the source dir to overwrite the destination, but I'd like to use the same command to overwrite the destination if it already exists, or move the source if it doesn't.

© Server Fault or respective owner

Related posts about bash

Related posts about command