November 20, 2014
https://issues.dlang.org/show_bug.cgi?id=13758

          Issue ID: 13758
           Summary: RDMD renames directory if -ofNAME is the name of a
                    directory
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: tools
          Assignee: nobody@puremagic.com
          Reporter: andrej.mitrovich@gmail.com

-----
~/somedir $ mkdir foo
~/somedir $ echo asdf > foo/bar
~/somedir $ ls foo
> bar
~/somedir $ echo "void main() { }" > app.d
~/somedir $ rdmd -offoo app.d
~/somedir $ ls
app.d  foo  foo.635520880476161823-23425.old
-----

The "foo.hash.old" is the old folder which was renamed to make place for the 'foo' executable.

I don't think RDMD should have the power to move things around like that. It should fail compilation if the output name would overwrite the directory, with optionally providing a special switch for when you really need this behavior (I don't see the point of the feature though..).

--