苏州有哪些做网站公司好,wordpress资源下载类模板,宁波seo在线优化方案,微信公众平台如何与wordpress对接实现自动回复功能每次编译代码成功后都会生成obj/bin等文件夹。因此想清理这些文件夹#xff0c;无奈工程数量较多#xff0c;每个都要手动去删除比较累。就想到用代码写个小工具删除#xff0c;当然也可以利用bat批处理删除。
using System;
using System.Collections.Generic;
using Syst…每次编译代码成功后都会生成obj/bin等文件夹。因此想清理这些文件夹无奈工程数量较多每个都要手动去删除比较累。就想到用代码写个小工具删除当然也可以利用bat批处理删除。
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;namespace ClearBinObj
{internal class Program{private static void Main(string[] args){try{var rootFolder Directory.GetCurrentDirectory();Console.WriteLine(-----------开始清理obj文件夹和bin文件夹------------);DeleteObjBin(rootFolder);Console.WriteLine(-------------------已完成清理--------------------);Console.ReadLine();}catch (Exception ex){Console.WriteLine(ex.Message);Console.Read();}}private static void DeleteObjBin(string rootPath){try{string binFolderPath Path.Combine(rootPath, bin);string objFolderPath Path.Combine(rootPath, obj);if (Directory.Exists(binFolderPath)){Directory.Delete(binFolderPath, true);Console.WriteLine($删除文件夹{binFolderPath});}if (Directory.Exists(objFolderPath)){Directory.Delete(objFolderPath, true);Console.WriteLine($删除文件夹{objFolderPath});}var subFolders Directory.GetDirectories(rootPath);foreach (var folder in subFolders){DeleteObjBin(folder);}}catch (Exception ex){Console.WriteLine(ex.Message);}}}
}