title: CreateDirectory() and parent directories as needed
body: <p>Is there any way of creating a directory with the windows API and all its parent directories as needed with one function? I mean something as mkdir -p in Linux.</p>
  
  <p>I've found this function but it does not seem to work, and is almost deprecated: <a href="https://msdn.microsoft.com/en-us/library/bb762131%28v=vs.85%29.aspx" rel="nofollow noreferrer">SHCreateDirectoryEx()</a></p>
  
  <p>I've also found this stack overflow <a href="https://stackoverflow.com/questions/8931196/createdirectory-windows-api-usage-in-c">question</a> that seems quite similar to mine, but actually the OP is creating a subdirectory in a directory that already exists.</p>
  
  <p>My third approach would be to iterate through the path in order to create all directories one by one, but I dont really like this option. There has to be a much better way to do it!</p>