700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > python:复制文件夹及内容(包含子文件夹)到指定目录

python:复制文件夹及内容(包含子文件夹)到指定目录

时间:2019-09-14 17:04:55

相关推荐

python:复制文件夹及内容(包含子文件夹)到指定目录

import yamlimport osimport shutildef copyHistorySession():source_path5048 = r'D:\sourse'target_path5048 = r'D:\target'if not os.path.exists(target_path5048):# 如果⽬标路径不存在原⽂件夹的话就创建os.makedirs(target_path5048)if os.path.exists(source_path5048):# 如果⽬标路径存在原⽂件夹的话就先删除shutil.rmtree(target_path5048)shutil.copytree(source_path5048, target_path5048)print('copy 5048 History Session finished!')

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。