. . . . without testing things by jiggling handles and seeing whether or not you stimulate an error . . . especially since you now have an ugly filesystem access to clean up the directories you created along the way. Much better to just stat() the thing and be done with it.
Oh, and why create intervening directories and keep moving? At the first missing directory, you know the path is invalid, and you're not going to create a new directory and find valid paths rooted in it. Puzzling . . . unless, of course, you were actually trying to implement `mkdir -p` . . .
I've got good news, and I've got bad news: The universe is merely a figment of my imagination. Now are you ready for the bad news?
Oh, and why create intervening directories and keep moving? At the first missing directory, you know the path is invalid, and you're not going to create a new directory and find valid paths rooted in it. Puzzling . . . unless, of course, you were actually trying to implement `mkdir -p` . . .
I've got good news, and I've got bad news:
The universe is merely a figment of my imagination.
Now are you ready for the bad news?