This is a problem I had myself, and I
solved it here ... That code has been in production for some time and it just works ;) It does expect the different files to be in chronological order, though ... Even if that's not the case on your end, the script might get you on the way ...