Not until the BSD rename system call,.

Try it on V6 or V7 and you will get 'directory exists' as an error.

Think about the UNIX FS and the link system call. How is mv implemented?   You link the file to the new directory and the unlink it from the old one.   But a directory file can not be in two directories at the same time as the .. link would fail.      When Joy created the rename system call it became possible.  Until System V picked it up (IIRC was SVR3), only system that supported the BSD world.

What I have forgotten is if the BSD mv command for 4.1 supported it.  If it did then it was not atomic -- it would have had to create the new directory, move the contents independently and then remove the old one.

FWIW: when we did the first SMP UNIX at Masscomp we had supported the BSD FS and the 4.1c/4.2 system calls.   Joy's implementation of rename was a real mess.   Making it atomic, supporting an SMP and deal with all the recovery paths on an error took some work.  It's funny, the rename system call is a simple idea, but on a failure when partially thru it, makes unwinding the partial completion an interesting problem. 


On Wed, Dec 29, 2021 at 9:34 AM Will Senn <> wrote:
I'm a little flummoxed in trying to move some directories around in svr2. Shouldn't the following work?

    mkdir a
    mkdir b
    mv a b

I get the following error:
    mv: b exists

I tried many of the possible variants including:
mv a b/
mv: b/ exists
mv a b/a
mv: directory rename only
cd b
mv ../a .
mv: . exists
mv ../a ./
mv: ./ exists
mv ../a ./a
mv: directory rename only

If moving directories into existing directories wasn't allowed in those days, 1) how were directories managed? and 2) when did moving directories into directories become a thing?