Theory and Practice
About Archives Categories Tags Authors 中文 ไทย

[Python] mkdir -p

February 21, 2016
Edit on Github

mkdir -p command in Python

import os

def mkdirp(dirpath):
    if not os.path.exists(dirpath):
        os.makedirs(dirpath)

Tested on: Ubuntu Linux 15.10, Python 2.7.10.


References:

[1]python mkdir p
[2]mkdir -p functionality in Python - Stack Overflow

Author: Siong-Ui Te
∈ Category: Python
∑ Tags: Python , Bash , Commandline
Powered by Github Pages, Pelican, pyScss.