The DOS command mkdir will create nested paths. Is there a reason you can't just do a system call instead of using the CreateFolder function?