mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Initial revision
This commit is contained in:
parent
c99a4f900d
commit
b83ec8f58d
5 changed files with 243 additions and 0 deletions
20
Demo/scripts/makedir.py
Executable file
20
Demo/scripts/makedir.py
Executable 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()
|
Loading…
Add table
Add a link
Reference in a new issue