是否可以查询文件系统? [英] Is it possible to query the filesystem?

查看:83
本文介绍了是否可以查询文件系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我仅通过迭代某些文件扩展名来搜索文件系统中的文件.可以这么说,这是我可以查询的最接近的文件系统吗?搜索文件系统时,有什么方法可以节省一些时间?


谢谢您的意见!! :)

Currently I am searching files in my filesystem by means of iterating only certain file extensions. Is this the closest I can come to querying the filesystem so to speak? Is there a way to shave off a bit of time while searching the filesystem?


thank you for your input!! :)

推荐答案

有几种方法可以使文件搜索更有效.一种提高性能的方法是使用线程(特别是任务并行库).另一个方法是缓存结果,而不是一遍又一遍地读取文件.最后,您可以使用进行索引的第三方库(我不知道有没有免费的库).

至于查询"文件系统的任何其他方式,这就是您执行的方式.没有一种方法可以针对文件系统编写查询".您列出所有文件,然后在该列表中搜索所需的文件.
There are a few ways you can make file searching more efficient. One way to improve performance would be to use threading (the Task Parallel Library specifically). Another would be to cache the results instead of reading through the files over and over. Finally you could use a third-party library (I don''t know of any free ones) that does indexing.

As far as any other way to "query" the file system, this is the way you do it. There isn''t a way to write "queries" against the file system. You list all the files and search for the one you want inside that list.


这篇关于是否可以查询文件系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆