Do not remove dir entry if it has the same name as the parent

This fixes an issue when a subdir has the same name as its parent, it
would get exluded from the list.