type TForm1 = class(TForm) Button1: TButton; ListBox1: TListBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } Procedure Finddir(dir:string); end;
var Form1: TForm1;
implementation
{$R *.DFM}
Procedure Tform1.Finddir(dir:string); var SearchRec: TSearchRec; begin If Copy(dir,Length(dir),1)<>\'\\\' then dir:=dir+\'\\\'; IF not DirectoryExists(dir) then begin showmessage(\'Directory \"\'+dir+\'\" does not exist!\'); exit; end; If FindFirst(dir+\'*.*\', faAnyFile, SearchRec)=0 Then Repeat If SearchRec.Attr=faDirectory Then begin If (SearchRec.Name=\'.\')or(SearchRec.Name=\'..\') then Continue; //loop through subdirs FindDir(dir+SearchRec.Name); end else begin if Extractfileext(dir+SearchRec.Name)=\'.dat\' then combobox1.Items.Add(dir+SearchRec.Name); end; until FindNext(SearchRec) <> 0; FindClose(SearchRec); end;
procedure TForm1.Button1Click(Sender: TObject); begin finddir(\'C:\\Windows\'); end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.