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")
精彩评论