# 这个脚本是将r'Y:\Project\SCD\SDVDS\VFDVD-Rename'下的d号文件名,重命名为'2021-04-07--0031-P1' rootPath = r'Y:\Project\VDFVD\rVDF00DFVD030\VV-Rename' excel = r'Y:\Project\VDFVD\r00VFDV030\VDFVF数据.xlsx' import os import pandas as pd lsDir = os.listdir(rootPath) edata = pd.read_excel(excel) for dirName in lsDir: oldName = dirName oldName = rootPath+'/'+dirName a = edata[edata['VDFVFD']==dirName].iloc[0,4] b = edata[edata['DVFD项VF目VF']==dirName].iloc[0,5] newName = a+'--'+b newName = rootPath+'/'+newName print("oldname is {}, new name is {}".format(oldName, newName)) os.rename(oldName, newName)
Python 重命名 文件夹
最新推荐文章于 2024-06-25 15:01:18 发布