Move files to folders

Not sure I'm missing some cases. It seems to work now.