如何进行全硬盘文件查找。比如,在d盘下查找所有文件名后缀为.txt的文件名及其绝对路径。望各大侠援助!!!
解决方案 »
- 在D7上用grid+report4.0时遇到了Invalid floating point operation
- 参加南京天泽信息产业有限公司笔试回来了...
- 请教Google桌面搜索Delphi文件索引编制问题。
- 添加 TreeView 节点的小问题
- 怎样显示XML数据库啊????
- sql中如何存取ole 对象数据。。
- adodataset1.filter中怎么过滤组合查询
- fastreport 分组分页问题,分不够了,请多帮忙.
- web browser 获得事件代码的问题
- 怎样对一个实数向上取整?
- 请教高手:使用普通的TABEL/qUERY组件或者ADO的 TABEL/QUERY组件连接excel可以成功,但是有些数据不能显示,为什么?
- 怎么做系统登录程序——————在线等待!!!!!
http://community.csdn.net/Expert/topic/3831/3831624.xml?temp=.6947138
要用递归.
心情不好,不多写了,下面只是一个用findfirts,findnext语句的参考例子.procedure TForm1.Button1Click(Sender: TObject);
var
sr: TSearchRec;
begin
if Trim(filepath)<>'' then
begin
if FindFirst(filepath+'*.txt', faAnyFile, sr) = 0 then //所有.txt文件
begin
repeat
if (sr.Attr and faAnyFile) = sr.Attr then //faAnyfile 所有文件
begin
shellexecute(0,'open',pchar(Edit1.Text+sr.Name),nil,nil,sw_show);//打開
end;
until FindNext(sr) <> 0; //查找下一個
FindClose(sr); //結束查找
end;
end;
end;
// findfirst 語句,找到返回值為0,否則不為0