That gives the same error if part of the path exists or it can't be created. The version here creates each part separately so can tell the difference between 'exists' and other errors.

hokey, i know. i don't know of an alternative.