Extended version. Slightly whizzier than the original
as it created the output directory if necessary (although
I only tested this on Windows and as I recall it didn't work
on LP's OS X box but we didn't have time to look at that)
but more interestingly it separates out the multiple sections
properly and gives them headers.