Python批量更改文件目录名
程序员文章站
2022-03-02 14:16:31
...
# 位置: /root/pycharm_project_365/static/train_set
import os
move_name = os.listdir('/root/pycharm_project_365/static/train_set')
new_name = '20152649'
for temp in move_name:
os.rename('/root/pycharm_project_365/static/train_set/' + temp,
'/root/pycharm_project_365/static/train_set/' + new_name)
new_name = str(int(new_name) + 1)