1

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.

I've found this function but it does not seem to work, and is almost deprecated: SHCreateDirectoryEx()

I've also found this stack overflow question that seems quite similar to mine, but actually the OP is creating a subdirectory in a directory that already exists.

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!

Community
  • 1
  • 1
gccinac
  • 103
  • 2
  • 11
  • 4
    `SHCreateDirectoryEx()` works here. You write "it does not seem to work". There is no "seems" in programming, either it works or it doesn't. And if it doesn't, it returns an error code which tells you why it doesn't work. – Jabberwocky Feb 02 '16 at 10:42
  • 1
    How exactly is SHCreateDirectoryEx() "not working"? Which error code did it return? I used this API function recently and there was not the slightest problem. – Bart Feb 03 '16 at 08:37
  • My bad... I was looking at the wrong part of the code. Now it works :) – gccinac Feb 03 '16 at 08:45

0 Answers0