added directory flatten

Flattens a directory