把所有dw的shell文件都转成pw

import os
import shutil

link = './'
target = "./pw/"

for i in os.listdir(link):
    if i.endswith('.sh'):
       print(i)
       new = i.replace("dw","pw")
       print(new)
       if i != new:
          shutil.copy(i,new)

 

posted on 2020-05-05 12:20  cdekelon  阅读(60)  评论(0)    收藏  举报

导航