simplified getting directory names and file extensions