You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
329 B

4 months ago
import os
# 获取指定路径下的文件
4 months ago
dirs = os.listdir("/")
4 months ago
# 循环读取路径下的文件并筛选输出
for i in dirs:
4 months ago
if os.path.splitext(i)[-1] == ".so":
4 months ago
old_name = i
4 months ago
new_name = i.split('.')[0] + ".so"
4 months ago
os.rename(old_name, new_name)
print("rename:" + old_name + "->" + new_name)