import os def rename_func(path): for file in os.listdir(path): fileNew = file.lower() print("Old:", file, "New", fileNew) if(fileNew != file): os.rename(path + file, path + fileNew) path2 = "C:\\Program Files\\MATLAB\\R2014b\\toolbox\\gatbx\\Test_fns\\" rename_func(path2)
原文:https://www.cnblogs.com/tangjicheng/p/9116345.html