# coding=utf-8
# @author:Damon Qu
# @contact:qufengw@126.com
# @date:2018/4/28
import os
'''
读取指定文档,文档中每一行为一个目录,递归创建所有目录
'''
def create_dirs(path):
# 判断目录是否存在
isExists = os.path.exists(path)
if isExists:
print('%s is exists' % path)
else:
os.makedirs(path)
print('%s create ok' % path)
print("读取指定文档,文档中每一行为一个目录,递归创建所有目录")
file = input("enter the file path:")
with open(file) as f:
while True:
line = f.readline().strip()
if len(line) == 0:
break
else:
create_dirs(line)