stripping whitespace from directory data in case of excess newlines.