in reply to split of files
It is not quite clear to me what you want to do. Try to explain your algorithm that decides what should go into each file. There is helpful advice here on how to How (Not) To Ask A Question.