怎么取得某文件夹下的所有第一层文件夹名和文件名?

nenu0 2003-10-20 09:59:23
比如说取得film文件夹下的第一层文件及文件夹名,不需要再往下取了。就要一层的。
...全文
105 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingting 2003-10-21
  • 打赏
  • 举报
回复
uses ShellAPI, FileCtrl,…等其他

procedure TfrmMain.GetSrcDir;
var
sr: tsearchrec;
Found:integer;
s1, s2: integer;
begin
Memo1.Lines.Clear;
files.Clear;
Found:=FindFirst(Edit1.Text+'*',faAnyFile,sr);
try
while found=0 do
begin
Files.Add(sr.Name);
// Memo1.Lines.Add(' time | ' + DateTimeToStr(FileDateToDateTime(sr.Time)));
// Memo1.Lines.Add(' | ' + datetimeToStr(GetFiledateTime(sr.Name,fttCreation)));
if (sr.attr and faDirectory > 0) then
Memo1.Lines.Add('[' + sr.Name + ']') //表示目录
else
Memo1.Lines.Add(sr.Name);
Found:=FindNext(sr);
end;
finally
FindClose(sr);
end;
end;
nenu0 2003-10-21
  • 打赏
  • 举报
回复
up

5,379

社区成员

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

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