DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: xiao2024
今日帖子: 15
在线用户: 16
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/7/15 13:16:17
标题:
分享:快速全盘搜索特定类型的所有文件 浏览:2229
加入我的收藏
楼主: 本是为坛里,某个同学写的。
但写好后,他又不要了。
哎。对这种行为,我也无能为力。

所以,这里只有程序,没有源码。敬请谅解。
此帖子包含附件:dbyoung_2021715131615.zip 大小:780.9K
----------------------------------------------
武汉天气不好
作者:
男 star5 (星五) ★☆☆☆☆ -
盒子活跃会员
2021/7/15 15:01:30
1楼: 感谢分享,顺便推荐一下 Everything
----------------------------------------------
博客 - http://offeu.com
脚本模型 - http://webpascal.com
需要短信接口的请联系我,可发行业与营销内容。
作者:
男 dalas (dalas) ★☆☆☆☆ -
普通会员
2021/7/15 15:29:58
2楼: 想要一个能搜索包含指定字符串的文件,
我以前写过一个,但搜索超大文件效率非常低,比如几个GB的文件,几乎就跟死机没啥区别
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/7/15 22:16:29
3楼: "FIND" command by MSWindows O.S. is native in all MSWindows editions.

you can use "PIPE" character =>>>  "|"
to redirect many output of many commands with output to screen or printer or same to another command.

ex.:
     echo "hello World" | find /i /n "world"

or any others commands from O.S. include to create a new file

 echo "hello World" | find /i "world" > output.txt

etc...
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/7/15 22:20:05
4楼: simple sample
delphibasics.co.uk/RTL.asp?Name=filesearch

... others

https://stackoverflow.com/questions/6546105/how-to-search-a-file-through-all-the-subdirectories-in-delphi

https://stackoverflow.com/questions/5012664/fast-search-to-see-if-a-string-exists-in-large-files-with-delphi

https://stackoverflow.com/questions/4845380/how-can-i-efficiently-read-the-first-few-lines-of-many-files-in-delphi
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/7/15 22:30:35
5楼: @emailx45:
   I wonder if you're like us. 
   Translate English pages into Chinese, 
   do you translate Chinese pages into English? 
   Or, can you read Chinese?
----------------------------------------------
武汉天气不好
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/7/15 22:48:45
6楼: 我是巴西人,并使用 Google 翻译器
——我不会说英语
——我不会说中文,

但如果你愿意,我可以尝试用中文输入文本......没问题! 

拥抱
------
im Brazliand and use the Google translator

-- I dont speak English
-- I dont speak Chinese

but i can try type text in Chinese if you want... not problem!

hug
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 kenliaoliao (ben) ★☆☆☆☆ -
普通会员
2021/7/16 8:15:02
7楼: 下面是在Delphi 10.3下测试通过的可以搜索文件的代码

FilesList :=TStringList.Create;
FilesList :=System.IOUtils.TDirectory.GetFiles(APath, '*.csv', TSearchOption.soTopDirectoryOnly);

//TSearchOption = (soTopDirectoryOnly, soAllDirectories);
----------------------------------------------
-
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/7/16 9:06:54
8楼: TDirectory.GetFiles 简单的查询可用。
如果是全盘搜索,这个函数可就无能为力了。
而且如果文件一多,TStringList 就有可能撑爆了。
如果是单线程,是以天为单位的。4T硬盘,大约需要2天;
如果是多线程,是以时为单位的。4T硬盘,大约需要2小时;

我的那个程序,是以分为单位的。4T硬盘,大约需要8分钟;
如是固态硬盘,是以秒为单位的。2T固态,大约需要30秒钟;

这是我的测试结果。磁盘总文件数为2千万,符合查询条件的文件为10万。
----------------------------------------------
武汉天气不好
作者:
男 keymark (嬲) ▲▲▲△△ -
普通会员
2021/7/16 9:20:44
9楼: 1 .文件映射
2 .高级指令集 处理字符串(github.com)
3 .用Everything方式拿到所有需要的文件(csdn上有delphi的文章吧)
按此在新窗口浏览图片
我会说不会写。按此在新窗口浏览图片
----------------------------------------------
[alias]  co = clone --recurse-submodules  up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/7/16 9:39:22
10楼: 文章在这里:
  Delphi 版 everything、光速搜索代码
  https://blog.csdn.net/dbyoung/article/details/80050792
----------------------------------------------
武汉天气不好
作者:
男 wg961423 (麦子仲肥) ★☆☆☆☆ -
盒子活跃会员
2021/7/16 14:17:21
11楼: 如果不是NTFS的盘,除了枚举,还有啥快速的方法?
----------------------------------------------
-
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/7/16 15:14:32
12楼: 读取 Fat32 表。和读取 NTFS 方法是类似的。
Win98 时代的产物。现在 Fat32 很少了吧。
----------------------------------------------
武汉天气不好
作者:
男 wr960204 (武稀松) ★☆☆☆☆ -
盒子活跃会员
2021/7/19 11:37:43
13楼: @dbyoung (dbyoung)
你这篇文章细节优化还是有很多问题100万文件他说要7秒,当年我在做光速搜索1.0的时候记得几百万文件是100毫秒以内
----------------------------------------------
武稀松http://www.raysoftware.cn
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/7/19 12:30:09
14楼: 光速搜索,的确很快。比 everything 还快。

我的那个,是个基本的程序。没有什么好的优化。
当年写的时候,也就那个水平。
现在写,估计要快一点。

但仅枚举 USN ,不获取全路径文件名 ,也不止是毫秒级吧?
武哥如果能提示一二,那就最好不过了。
----------------------------------------------
武汉天气不好
作者:
男 wg961423 (麦子仲肥) ★☆☆☆☆ -
盒子活跃会员
2021/7/19 14:04:10
15楼: @dbyoung (dbyoung)
不是Fat32,而是exFat/ReFS之类的
----------------------------------------------
-
作者:
男 hsj (hsj) ★☆☆☆☆ -
盒子活跃会员
2021/7/23 9:46:05
16楼: 读取某个文件夹,有啥好办法快起来,毕竟读整个盘的机会不多,大部分都是某个目录
----------------------------------------------
qq:171833017,靖源软件http://www.dxmylove.com
作者:
男 tuesdays (Tuesday) ▲▲▲▲△ -
普通会员
2021/7/23 11:19:50
17楼: 写程序的都智商低.. 

你弄个路径出来, 至少弄可复制, 或者可以定位文件啊. 
让人怎么用!!!
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行85.9375毫秒 RSS