11 people like it.
Like the snippet!
Recursively find all files from a sequence of directories
A function that will take a sequence of directory names and recursively find and return a sequence of all file names within.
1:
2:
3:
4:
5:
|
open System.IO
let rec allFiles dirs =
if Seq.isEmpty dirs then Seq.empty else
seq { yield! dirs |> Seq.collect Directory.EnumerateFiles
yield! dirs |> Seq.collect Directory.EnumerateDirectories |> allFiles }
|
namespace System
namespace System.IO
val allFiles : dirs:seq<string> -> seq<string>
Full name: Script.allFiles
val dirs : seq<string>
module Seq
from Microsoft.FSharp.Collections
val isEmpty : source:seq<'T> -> bool
Full name: Microsoft.FSharp.Collections.Seq.isEmpty
val empty<'T> : seq<'T>
Full name: Microsoft.FSharp.Collections.Seq.empty
Multiple items
val seq : sequence:seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Core.Operators.seq
--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>
Full name: Microsoft.FSharp.Collections.seq<_>
val collect : mapping:('T -> #seq<'U>) -> source:seq<'T> -> seq<'U>
Full name: Microsoft.FSharp.Collections.Seq.collect
type Directory =
static member CreateDirectory : path:string -> DirectoryInfo + 1 overload
static member Delete : path:string -> unit + 1 overload
static member EnumerateDirectories : path:string -> IEnumerable<string> + 2 overloads
static member EnumerateFileSystemEntries : path:string -> IEnumerable<string> + 2 overloads
static member EnumerateFiles : path:string -> IEnumerable<string> + 2 overloads
static member Exists : path:string -> bool
static member GetAccessControl : path:string -> DirectorySecurity + 1 overload
static member GetCreationTime : path:string -> DateTime
static member GetCreationTimeUtc : path:string -> DateTime
static member GetCurrentDirectory : unit -> string
...
Full name: System.IO.Directory
Directory.EnumerateFiles(path: string) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateFiles(path: string, searchPattern: string) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateFiles(path: string, searchPattern: string, searchOption: SearchOption) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateDirectories(path: string) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateDirectories(path: string, searchPattern: string) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateDirectories(path: string, searchPattern: string, searchOption: SearchOption) : System.Collections.Generic.IEnumerable<string>
More information