目录路径内容过滤
是否有可能从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 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.