批量重命名文件

Posted by Liang Chen on June 1, 2021
1
2
3
4
5
6
7
8
9
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os
import re

for old_name in os.listdir(path='./'):
  new_name = re.sub(r'-min', "", old_name)
  os.rename(old_name, new_name)