# -*- coding:utf-8 -*-
import os
import shutil
src_path = "F:\\test1"
dst_path = "F:\\test2"
def mycopy(srcpath, dstpath):
if not os.path.exists(srcpath):
print("srcpath not exist!")
if not os.path.exists(dstpath):
print("dstpath not exist!")
for root, dirs, files in os.walk(srcpath, True):
for eachfile in files:
shutil.copy(os.path.join(root, eachfile), dstpath)
if __name__ == "__main__":
mycopy(src_path, dst_path)
python3将某个目录的所有子目录中的文件拷贝到另一个目录下
最新推荐文章于 2022-06-27 18:08:48 发布