# Python program to explain os.makedirs() method
# importing os module
import os
# Leaf directory
directory = "ranjeet"
# Parent Directories
parent_dir = "/home/User/Documents/Softhunt/Authors"
# Path
path = os.path.join(parent_dir, directory)
# Create the directory
# 'ranjeet'
os.makedirs(path)
print("Directory '%s' created" %directory)
# Directory 'Softhunt' and 'Authors' will
# be created too
# if it does not exists
# Leaf directory
directory = "c"
# Parent Directories
parent_dir = "/home/User/Documents/Softhunt/a/b"
# mode
mode = 0o666
path = os.path.join(parent_dir, directory)
# Create the directory
# 'c'
os.makedirs(path, mode)
print("Directory '%s' created" %directory)
# 'Softhunt', 'a', and 'b'
# will also be created if
# it does not exists
# If any of the intermediate level
# directory is missing
# os.makedirs() method will
# create them
# os.makedirs() method can be
# used to create a directory tree