daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open System
  2. open System.IO
  3.  
  4. [<EntryPoint>]
  5. let main argv =
  6.     let rec getRootFolder () =
  7.         printfn "Bitte geben Sie den zu bereinigenden Ordner an:"
  8.         let input = Console.ReadLine()
  9.         if Directory.Exists(input) then
  10.             input
  11.         else
  12.             getRootFolder()
  13.  
  14.     let rec iterateThroughDirectoryAndDelete currentPath  =
  15.         Directory.GetDirectories currentPath |> Array.iter iterateThroughDirectoryAndDelete
  16.         let lastFolderInPath = currentPath.Split Path.DirectorySeparatorChar |> Array.last
  17.         match lastFolderInPath with
  18.         | "packages" | "bin" | "obj" -> (Directory.Delete(currentPath,true))
  19.                                         printfn "%s wird gelöscht" currentPath
  20.         |_ -> ()
  21.            
  22.     getRootFolder() |> iterateThroughDirectoryAndDelete
  23.  
  24.     printfn "Ende"
  25.     Console.ReadKey() |> ignore
  26.     0 // return an integer exit code
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top