我怎样才能获取所有不以“Something”开头的文件?

发布于 2024-08-17 23:41:48 字数 154 浏览 3 评论 0原文

下面的行获取以 Cake 开头的所有文件。

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

我如何编写搜索模式来获取所有不以 Cake 开头的文件?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酒儿 2024-08-24 23:41:48

只是想提供 VB.Net 版本(从 @Daniel A. White 的 C# 版本转换而来),以防其他人偶然发现这一点。

Dim FI = DI.GetFiles().Where(Function(f) Not f.Name.StartsWith("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"))
心安伴我暖 2024-08-24 23:41:48

这将是用 C# 编写的,但它应该会让您接近。

FileInfo fi[] = di.GetFiles();
var doNotFiles = fi.Where(file => !file.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")); 
死开点丶别碍眼 2024-08-24 23:41:48

您获取所有以某些内容开头的文件,并使用所有不在该列表中且在原始列表中的文件?

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文