Hola danielmj.
A ver si entendí lo que buscas...
Código Delphi
[-]
function NroArchivos(aName: string): Integer;
var
SR: TSearchRec;
begin
Result := 0;
aName := IncludeTrailingPathDelimiter(ExtractFilePath(aName)) + '*.*';
if FindFirst(aName, faAnyFile+faArchive+faHidden+faReadOnly, SR) = 0 then
begin
repeat
Inc(Result);
until FindNext(SR) <> 0;
FindClose(SR);
end;
end;
Ejemplo de uso:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := 'C:\Windows\Explorer.Exe'; Label1.Caption := Format('Cantidad de archivos: %d',[NroArchivos(Edit1.Text)]);
end;
Saludos