Pages

Monday, December 12, 2011

How to Get list files from a directory in delphi

This procedure below will list all files in a directory and add it to stringlist. Here is the function :
procedure GetFilenames(Path: string; Dest: TStrings);
var
  SR: TSearchRec;
begin
  if FindFirst(Path+'*.*', faAnyFile, SR) = 0 then
  repeat
    Dest.Add(SR.Name);
  until FindNext(SR) <> 0;
  FindClose(SR);
end;

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget