Delphi-Quellcode:
function CountFiles(FilePath: string): integer;
var
SearchRec: TSearchRec;
count: Integer;
begin
count := 0;
FilePath := IncludeTrailingPathDelimiter(FilePath);
if FindFirst(FilePath + '*.*', faAnyFile and not faDirectory, SearchRec) = 0 then
begin
repeat
Inc(Count);
until FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
result := count;
end;
EDIT → habe Dein EDIT nicht gesehen!