Make exclude_empty_directories deal with non-terminal directories.