clean build artifacts

This commit is contained in:
Matthew Parker [SSW]
2023-11-15 22:16:57 +10:00
parent b9b2d2c4ec
commit 0907901ca0
3 changed files with 45 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
namespace DotNetSolutionTools.Core;
public static class CleanFolder
{
public static void DeleteFolderWithOnlyBinAndObjSubFolders(string folderPath)
{
var binAndObjFolders = Directory.GetDirectories(folderPath, "*", SearchOption.AllDirectories)
.Where(x => x.EndsWith(Path.DirectorySeparatorChar + "bin") || x.EndsWith(Path.DirectorySeparatorChar + "obj"))
.ToList();
foreach (var folder in binAndObjFolders)
{
Directory.Delete(folder, true);
}
}
}