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()
转载于:https://www.cnblogs.com/setname/p/8417780.html