python 复制多个文件到指定目录(基于python 3.X)
import os
import shutil
def copyPDF():
addressPDF = "E:/totally/FinancePDF/"
f_list = os.listdir(addressPDF)
n=0
for fileNAME in f_list:
if os.path.splitext(fileNAME)[1] == '.pdf':
n += 1
oldname = u"E:\\totally\\FinancePDF\\" + fileNAME
newname = u"E:\\totally\\Finance_PDFfile\\" + fileNAME
shutil.copyfile(oldname, newname)
print(str(n)+'.'+'已复制'+fileNAME)
if __name__ == '__main__':
copyPDF()