#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Contact : liuyuqi.gov@msn.cn @Time : 2024/02/02 16:39:55 @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved. @Desc : rename dir spring-boot to springboot ''' import os,sys,re workdir= os.getcwd() def run(): for root, dirs, files in os.walk(workdir): for dir in dirs: if dir.startswith('spring-boot'): #rename dir newdir = dir.replace('spring-boot','springboot') os.rename(os.path.join(root,dir), os.path.join(root, newdir)) else: print("sss") pass if __name__=='__main__': run()