Get All Extension

open System.IO
open System

let rec getAllFiles dir =
    seq { yield! try 
                    Directory.EnumerateFiles(dir, "*.*") 
                 with 
                 | _ -> Seq.empty
          for d in (try 
                    Directory.EnumerateDirectories(dir) 
                    with 
                    | _ -> Seq.empty) do
              yield! getAllFiles d }

let GetAllExtension path =
    path
    |> getAllFiles
    |> Seq.map Path.GetExtension
    |> Seq.distinct
    |> Seq.iter Console.WriteLine

[<EntryPoint>]
let main argv = 
    GetAllExtension argv.[0]
    0

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注