import shutil
# 源文件路径
src_path = './file2Test'
# 目标文件路径
dest_path = './TestMoveFiles'
# # 判断目标文件夹是否存在,若不存在,则创建新文件夹
# if not os.path.exists(dest_path):
# os.makedirs(dest_path)
# 复制文件夹及其中的所有内容,创建目标文件夹
shutil.copytree(src_path, dest_path)
print("Files Moved Finished!!!")
Python代码实现: 将一文件夹中的内容移动到另一文件夹中,并且保留原始文件夹中的内容
最新推荐文章于 2024-03-11 15:42:07 发布