开发者

how can i filter only .sql files using directory.getfiles

I am trying to filter the only.sql files from given Directory 开发者_运维问答path

But it will compress the all files in the given directorypath

      string directorypath = @"C:\access";

        DirectoryInfo di = new DirectoryInfo(directorypath);

        foreach (FileInfo fi in di.GetFiles().Where(.sql))
        {

            CompressionMethod(fi);


        }

but , i want send only .sql files to this method CompressionMethod(fi) .... how can i do that

would any one pls help on this...

many thanks....


You should use di.GetFiles("*.sql")


there exists an overload of GetFiles with a searchpattern: GetFiles(string searchpattern)

so use:

di.GetFiles("*.sql")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜