开发者

How can i get all the files that DO NOT start with "Something"?

The line below fetches all files that start with Cake.

Dim fi As System.IO.FileInfo() = di.GetFiles("Cake*")

How can i write the开发者_高级运维 search pattern to get all the files, that do not start with Cake?


Just wanted to give the VB.Net version (converted from @Daniel A. White's C# version) in case anyone else stumbles on this.

Dim FI = DI.GetFiles().Where(Function(f) Not f.Name.StartsWith("Cake"))


This will be in C#, but it should get you close.

FileInfo fi[] = di.GetFiles();
var doNotFiles = fi.Where(file => !file.Name.StartsWith("Cake")); 


You get all the files that start with something and use all that are not in that list and are in the original list?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜