Skip to content

Instantly share code, notes, and snippets.

@atsapura
Created October 1, 2021 09:36
Show Gist options
  • Save atsapura/ed44b407268ca0d255139d2c7c5387f3 to your computer and use it in GitHub Desktop.
Save atsapura/ed44b407268ca0d255139d2c7c5387f3 to your computer and use it in GitHub Desktop.
proper clean of .net solution
open System.IO
let deleteBinAndObj (dirInfo: DirectoryInfo) =
let bin = dirInfo.GetDirectories("bin")
for dir in bin do
if dir.Name.ToLower() = "bin" then
dir.Delete(true)
let objDirs = dirInfo.GetDirectories("obj")
for dir in objDirs do
if dir.Name.ToLower() = "obj" then
dir.Delete(true)
let rec recursiveClean dir =
deleteBinAndObj dir
let children = dir.GetDirectories()
for child in children do
recursiveClean child
let clean() =
let dir = Directory.GetCurrentDirectory() |> DirectoryInfo
recursiveClean dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment