I need help. I use win7, and I'm writing a program that will archive data. The last thing I need is a create directory function that not just creates the last folder, but also creates the subfolders which are the parent of that folder if they don't exist. EX: CreateDirectory(".\\Sub1\\Sub2\\archive\\"); won't work correctly if Sub1 and Sub2 don't exist. I would have to create them before I created Archive. I need a function that will create the entire directory in 1 stroke.
I heard of SHCreateDirectoryEx, but it only works with winXP or older. So, does someone know a way to do this? I'm trying to avoid using a Batch.
SHCreateDirectoryEx is available on windows 7, and after looking through windows 8's version of shlobj.h it appears to be available on 8 as well. It isn't guaranteed to be available in future versions so kbw's solution is most likely a better option.