[bugfix] Do not exclude a dir from deleting if it exists as file

If a previous build included a file, and a new build includes a
directory with the same name as previously the file, this resul-
ted in the original file not being deleted. When an attempt was
made to create the new directory, it threw an exception.

Fixes #417, which I could still reproduce on latest master.