rebase files into directories