目录路径内容过滤

发布于 2024-10-01 07:46:43 字数 143 浏览 1 评论 0原文

是否有可能从 NSFileManager 路径中检索没有在某种没有 if 的过滤器中指定的路径?我知道有一种方法包括PropertiesForKeys,但它只能有预定义的键,我想使用自定义的...

有人遇到类似的问题吗?

任何建议表示赞赏。

is there possibility to retrive from NSFileManager paths without paths specified in some kind of filters without if's ? I know that there is a method includingPropertiesForKeys, but it can have only predefined keys, i would like to use custom ones...

Dose anybody encouter similar issus ?

Any sugestions are appreciated.

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

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

发布评论

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

评论(1

梦中的蝴蝶 2024-10-08 07:46:43

使用 NSFileManager 进行过滤的唯一方法是按照您的描述自行执行(循环内容、检查属性、将匹配项添加到“匹配”数组)。 ...includePropertiesForKeys:... 部分不是过滤器,它只是预获取所需的属性,因此您不必为每个返回的文件路径获取它们。

或者您可以使用 Spotlight 查询。

The only way to filter using NSFileManager is to do it yourself as you described (loop the contents, examine the properties, add matches to a "matches" array). The ...includingPropertiesForKeys:... part isn't a filter, it just pre-fetches the desired properties so you don't have to fetch them for each returned file path.

Or you could use a Spotlight query.

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