Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System.IO
- type FolderStatistic = { Name : string
- Size : int64 }
- let calculateFolderSize (folder : string) =
- Directory.GetFiles folder
- |> List.ofSeq
- |> List.sumBy (fun f -> FileInfo(f).Length)
- let subfolders : DirectoryInfo array =
- let folder = new DirectoryInfo(@"C:\\tmp")
- folder.GetDirectories()
- subfolders
- |> List.ofArray
- |> List.map (fun x -> { Name = x.Name; Size = calculateFolderSize x.FullName })
- |> List.sortByDescending(fun x -> x.Size)
Add Comment
Please, Sign In to add comment