from shutil import copy
import os
#diw 需拷贝的文件夹,newdir是拷贝的地方
def copy_dir(dir,newdir):
for p in os.listdir(dir):
print(p)
filepath=newdir+'/'+p
oldpath=dir+'/'+p
if os.path.isdir(oldpath):
print('是目录')
os.mkdir(filepath)
copy_die(oldpath,filepath)
if os.path.isfile(oldpath):
copy(oldpath,filepath)
copy_dir(r"c:/windows",r"d:/newwindows")