请问 关于 FindFirst的问题 我想查一种以上的后缀文件的时侯该怎么写? (在线等待)

xkfxd 2003-06-06 10:42:30
同上
...全文
27 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
xkfxd 2003-06-06
  • 打赏
  • 举报
回复
谢各位了 先结了吧 凑合用
WWWWA 2003-06-06
  • 打赏
  • 举报
回复
if ((sr.Name<>'.') and (sr.Name<>'..')) or (extractfileext(sr.name)=
.你的类型) then do something

foilsman 2003-06-06
  • 打赏
  • 举报
回复
//以下是删除g:\下的 *.txt和 *.bmp文件
var
sr : array[0..1] of TSearchRec;
strFile : array[0..1] of String;
begin
if (FindFirst('g:\*.txt', faAnyFile, sr[0]) and FindFirst('g:\*.bmp', faAnyFile, sr[1])) = 0 then
begin
repeat
strFile[0] := 'g:\' + sr[0].Name;
strFile[1] := 'g:\' + sr[1].Name;
DeleteFile(pChar(strFile[0]));
DeleteFile(pChar(strFile[1]));
Until
FindNext(sr[0]) <> 0 and FindNext(sr[1]);

FindClose(sr[0]);
FindClose(sr[1]);
end;
end;
fhuibo 2003-06-06
  • 打赏
  • 举报
回复
up
xkfxd 2003-06-06
  • 打赏
  • 举报
回复
WWWWA(aaaa) 说的还不错 只好先这么办了
STYun 2003-06-06
  • 打赏
  • 举报
回复
多一点还可以建立一个后缀的TStringList,
从STRINGLIST的第一个查找到最后一个就完了吗,也就是个2层的循环,办法是人想的,怕麻烦还得了?
WWWWA 2003-06-06
  • 打赏
  • 举报
回复
if ((sr.Name<>'.') and (sr.Name<>'..')) or (extractfileext(sr.name)=
你的类型) then do something
xkfxd 2003-06-06
  • 打赏
  • 举报
回复
那我还问个什么劲? 有没有直接点的?

要是多个几种不得累死?
STYun 2003-06-06
  • 打赏
  • 举报
回复
勤快一点点啦,分几次查找,反正是几个循环的问题,没有什么大不了的

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧