unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
procedure FillList(Root, Files: String);
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Liste: array of integer;
implementation
{$R *.dfm}
procedure TForm1.FillList(Root, Files: String);
var
SearchRec: TSearchRec;
begin
if Root[Length(Root)] <> '\' then
Root := Root+'\';
if FindFirst(Root+Files,faAnyFile,SearchRec) = 0 then
repeat
if (SearchRec.Attr and faDirectory) = faDirectory then
FillList(Root+SearchRec.FindData.cFileName,Files)
else
ListBox1.Items.Add(SearchRec.FindData.cFileName);
until FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FillList('C:\','*.*');
end;
end.