I've some files and directories within the directory
/var/foo/bar/baz. Now, I want to move all of them up into
/var/foo/bar, and get rid of baz. Easy, right?
cd /var/foo/bar mv baz/* . rmdir baz
(I'm ignoring files beginning with . for the sake of this discussion)
but! What if
baz/ contains a non-directory file named
baz? I can move it to someplace else, or use a temporary filename, then delete the directory
baz, then move it into place. But that's tedious and a lot of commands, too... is there another, customary, simpler/more-elegant way to do thus?
- If there are other name clashes, the normal semantics of
mv, which is to overwrite (and possibly prompt) are fine. But with
baz, it won't do that, it'll just fail.