Initial revision

This commit is contained in:
Guido van Rossum 1992-05-19 13:52:02 +00:00
parent c99a4f900d
commit b83ec8f58d
5 changed files with 243 additions and 0 deletions

20
Demo/scripts/makedir.py Executable file
View file

@ -0,0 +1,20 @@
#! /usr/local/python
# Like mkdir, but also make intermediate directories if necessary.
# It is not an error if the given directory already exists (as long
# as it is a directory).
# Errors are not treated specially -- you just get a Python exception.
import sys, os
def main():
for p in sys.argv[1:]:
makedirs(p)
def makedirs(p):
if not os.path.isdir(p):
head, tail = os.path.split(p)
makedirs(head)
os.mkdir(p, 0777)
main()