Batch to txt file name at the same time plus 1

import os,shutil
def copy_files():
path=‘D:\E\txt1’
new_path=‘D:\E\txt’
for dir,root,files in os.walk(path):
for file in files:
file=file.split(’.’)[0]
pic_file=file+‘1’+’.txt’
file=file+’.txt’
shutil.copy(os.path.join(dir,file),os.path.join(new_path,pic_file))
if name == ‘main’:
copy_files()

Published 41 original articles · won praise 7 · views 3682

Guess you like

Origin blog.csdn.net/weixin_43091087/article/details/103538755