开发者

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

开发者 https://www.devze.com 2023-04-11 19:05 出处:网络
I am trying to filter the only.sql files from given Directory 开发者_运维问答path But it will compress the all files in the given directorypath

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

精彩评论

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

关注公众号