Skip to content

Instantly share code, notes, and snippets.

@putridparrot
Created February 17, 2015 21:09
Show Gist options
  • Save putridparrot/4163295c5f36ce9eca67 to your computer and use it in GitHub Desktop.
Save putridparrot/4163295c5f36ce9eca67 to your computer and use it in GitHub Desktop.
F# functions to get directories all directories within a given path
let rec getDirectories' (di: DirectoryInfo) =
seq {
yield di
for sd in di.GetDirectories() do
yield! getDirectories' sd
}
let getDirectories path =
let di = new DirectoryInfo(path)
if not di.Exists then
Seq.empty
else
getDirectories' di
@putridparrot
Copy link
Author

Simple snippet of F# code to get the directories for a given path

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