1 people like it.
Like the snippet!
Are Files Present In A Directory?
A quick and dirty function to check to see if there are files present in a directory. Note this will return false if there are only subdirs in a directory.
1:
2:
3:
4:
|
open System.IO
let FilesArePresentInDirectory dir =
(Directory.EnumerateFileSystemEntries(dir) |> Seq.length) > (Directory.GetDirectories(dir) |> Seq.length)
|
namespace System
namespace System.IO
val FilesArePresentInDirectory : dir:string -> bool
Full name: Script.FilesArePresentInDirectory
val dir : string
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.EnumerateFileSystemEntries(path: string) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateFileSystemEntries(path: string, searchPattern: string) : System.Collections.Generic.IEnumerable<string>
Directory.EnumerateFileSystemEntries(path: string, searchPattern: string, searchOption: SearchOption) : System.Collections.Generic.IEnumerable<string>
module Seq
from Microsoft.FSharp.Collections
val length : source:seq<'T> -> int
Full name: Microsoft.FSharp.Collections.Seq.length
Directory.GetDirectories(path: string) : string []
Directory.GetDirectories(path: string, searchPattern: string) : string []
Directory.GetDirectories(path: string, searchPattern: string, searchOption: SearchOption) : string []
More information