Advertisement
Inforcer25

(Delphi) ListFileDir

Jun 3rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.42 KB | None | 0 0
  1. procedure ListFileDir(Path: string; FileList: TStrings);
  2. var
  3.   SR: TSearchRec;
  4. begin
  5.   if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
  6.   begin
  7.     repeat
  8.       if (SR.Attr <> faDirectory) then
  9.       begin
  10.         FileList.Add(SR.Name);
  11.       end;
  12.     until FindNext(SR) <> 0;
  13.     FindClose(SR);
  14.   end;
  15. end;
  16.  
  17. procedure TForm1.Button1Click(Sender: TObject);
  18. begin
  19.   ListFileDir('C:\WINDOWS\', ListBox1.Items);
  20. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement