Fix possibility of non-removed symlinked directory.

Fixes #4080