flattening the directory