Skip to content

Instantly share code, notes, and snippets.

@evgeniyp
Created March 2, 2016 18:26
Show Gist options
  • Save evgeniyp/38f0597f0abafd794722 to your computer and use it in GitHub Desktop.
Save evgeniyp/38f0597f0abafd794722 to your computer and use it in GitHub Desktop.
let handleEx ex =
printfn "Exception: %s" (ex.ToString())
false
let DelDir dir =
try
Directory.Delete(dir, true)
true
with ex -> handleEx ex
let DelDirs dirs = List.fold (fun acc dir -> acc && DelDir dir) true dirs
@pavel-khritonenko
Copy link

open ExtCore.Control.Collections
open System
let delDir dir = Choice.attempt (fun _ -> IO.Directory.Delete(dir, true))
let delDirs dirs = dirs |> Choice.Seq.iter delDir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment