rearrange input directory structure