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()
posted @ 2018-02-05 15:24  Moucong  阅读(7671)  评论(0编辑  收藏  举报