elegant way to make directory recursively in Python?
Posted
by user248237
on Stack Overflow
See other posts from Stack Overflow
or by user248237
Published on 2010-03-30T19:16:51Z
Indexed on
2010/03/30
19:23 UTC
Read the original article
Hit count: 427
I would like to make a directory in a "recursive" way, i.e. have a function make_directory() that behaves as follows:
make_directory("a/b/c/d/") should create directory a, then child b, then c, then d. If any of the parent directories exist it should not make them. E.g. if "a" exists, then b should be a subdir of that, and then c should be made inside b, etc.
how can I do this in python? os.mkdir does not have this behavior.
© Stack Overflow or respective owner