Ensure that the clean() call also cleans directories - as per the docs

Proposed change for https://bugs.eclipse.org/bugs/show_bug.cgi?id=396649