#!/usr/bin/python # -*- coding: UTF-8 -*- import os import shutil # 创建一个路径列表 path_list = [] path_list.append(os.path.join(os.getcwd(), "u2china_svr_proj/cfg/data")) path_list.append(os.path.join(os.getcwd(), "u2china_svr_proj/ServerComm/GameConfig")) path_list.append(os.path.join(os.getcwd(), "u2china_cli_proj/arpg/Assets/SvrDesc")) path_list.append(os.path.join(os.getcwd(), "u2china_cli_proj/arpg/Assets/Scripts/AIMachine/HotFixLogic/GameConfig")) def CleanFolder(pathlist): #遍历 path_list for path in pathlist: # 遍历路径下的所有文件 if not os.path.exists(path): print("------Path: " + path + " not exist!") continue # 判断路径是否存在 for file in os.listdir(path): # 文件夹不处理 if os.path.isdir(os.path.join(path, file)): print("Folder: " + os.path.join(path, file)) continue # 判断是否是.meta文件 if not file.endswith(".meta"): # 删除文件 os.remove(os.path.join(path, file)) if __name__ == '__main__': print("CleanFolder Start!") CleanFolder(path_list) md5_file = os.path.join(os.getcwd(), "../u2china_share_proj/ExcelExport/ExportMd5File.txt") if os.path.exists(md5_file): os.remove(md5_file) print("CleanFolder Done!") exit(0)