2 """Broytman's shell utilities. Additional to shutil.py (standard library module)
4 Written by Broytman, Oct 1997. Copyright (C) 1997 PhiloSoft Design.
11 mkhier_error = "m_shutil.mkhier_error"
13 def mkhier(path): # Python implementation of UNIX' mkdir -p /path/to/dir
14 if os.path.isdir(path):
15 return # It's Ok to have the directory already created
17 if os.path.exists(path):
18 raise mkhier_error, "`%s' is file" % path
20 list_dirs = string.split(path, os.sep)
22 for i in range(0, len(list_dirs)):
23 new_path = string.join(list_dirs[0:i+1], os.sep)
24 if (new_path <> '') and (not os.path.exists(new_path)):
25 #print "Making", new_path
35 mkhier("I.AM/creating/TEST/dir")
37 if __name__ == "__main__":