Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • No, this has not the same behaviour. Commented Jan 15, 2018 at 4:08
  • @wim, Really? Why not? What am I missing? Commented Jan 15, 2018 at 4:09
  • For example if a file with the name exists (not a directory). Commented Jan 15, 2018 at 4:10
  • 1
    Doesn't that check technically get applied to every part of the path. Commented Jan 15, 2018 at 4:25
  • 1
    This code has a race condition (another process could execute a system call between the system calls from this process to check for existence and for creating an entry). A more robust approach is to just attempt to create eaoh directory, and catch the error for "directory already exists". Handling "name exists but isn't a directory" is an interesting challenge. Commented Jan 15, 2018 at 7:25