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

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