import os
from shutil import copy
src_path = 'E:/hello'
dst_path = 'F:/hello'
def copyFiles(dir,topdown=True):
for root, dirs, files in os.walk(dir, topdown):
for name in files:
pathname = os.path.splitext(os.path.join(root, name))
copy(os.path.join(root,name), os.path.join(dst_path,name))
#print(os.path.join(root,name))
copyFiles(src_path)
Python批量复制目录下的所有文件到其他目录
于 2024-03-11 15:42:07 首次发布