flatten tree directory