You are here : python_2ososmakedirs

os.makedirs() - os

             

The method makedirs() is recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory.


  • path -- This is the path, which needs to be created recursively.

  • mode -- This is the Mode of the directories to be given.


Syntax


os.makedirs(path[, mode])


Example


#!/usr/bin/python

import os, sys

# Path to be created
path = "/tmp/home/monthly/daily"

os.makedirs( path, 0755 );

print "Path is created"


Output / Return Value

When we run above program, it produces following result:


Path is created


Limitations


Alternatives / See Also


Reference