⤷ Detect all files in directory

Use SearchFiles procedure. You should specify a directory, and after that, this function returns a list of files in this folder.
Main moments are FindFirst and FindNext functions.

procedure TForm1.SearchFiles(St: string);
var
  MySearch: TSearchRec;
  FindResult: Integer;
begin
  FindResult:=FindFirst(St+'\*.*', faAnyFile, MySearch);
  if (MySearch.Name<>'.')and(MySearch.Name<>'..') then
    Memo1.Lines.Add(MySearch.Name);
  while FindNext(MySearch)=0 do
  begin
    if (MySearch.Attr<>faDirectory)and
      (MySearch.Name<>'.')and
      (MySearch.Name<>'..') then
      Memo1.Lines.Add(MySearch.Name);
  end;
end;
More for developers