首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

掏出路径中的文件名

2013-03-12 
取出路径中的文件名取出路径中的文件名open System.IOlet rec allFilesUnder basePath seq {yield! Direc

取出路径中的文件名

取出路径中的文件名

open System.IO
let rec allFilesUnder basePath =
    seq {
        yield! Directory.GetFiles(basePath)
        for subdir in Directory.GetDirectories(basePath) do
            yield! allFilesUnder subdir
    }
allFilesUnder @"c:\"
|> Seq.take 10
|> Seq.toList
|> List.map (fun i -> i.Substring(i.LastIndexOf(@"\")+1))

热点排行