The classic way of doing this is to try the `mkdir()` first, and then if that returns an error, attempt the `stat()`. It's also possibly worth doing an explicit `stat()` so you can get proper errors from that call.