Hey there,
occassionally, people still seem to stumble across this script because it seems it shows up in some search results. Please be aware that I made this script ten years ago, and by now, there is probably a better way to achieve the same result.
Have a nice day!
Struggeled with the same task to convert schema to ldif files wondering why there is no straight forward conversion tool available. Well there is:
https://github.com/fusiondirectory/schema2ldif
It is also available in the ubuntu repository.