{$N+}
uses crt, dos;
const
maxDegree = 19;
step = 100 * 1024;
type
TLong = array[0..maxDegree] of Integer;
var
startDir : string;
sizes : TLong;
procedure GetFiles(fn, dir : string; var L : TLong);
var
search : SearchRec;
begin
if dir[length(dir)] <> '\' then
dir := dir + '\';
FindFirst(dir + fn, AnyFile, search);
while dosError = 0 do begin
if search.attr <> $10 then begin
writeln(search.name:15, (search.size div step) : 10);
inc(L[search.size div step])
end;
FindNext(search);
end;
FindFirst(dir + '*.*', Directory, search);
while doserror = 0 do begin
if (search.attr and 16 <> 0) and (search.name[1] <> '.') then
GetFiles(fn, dir + search.name, L);
FindNext(search);
end;
end;
Procedure Gyst(const arr: array of integer;
const size: integer);
var
i, j, max: integer;
mult_by: double;
begin
ClrScr;
max := arr[1];
for i := 1 to pred(size) do
if max < arr[i] then max := arr[i];
mult_by := 60 / max;
for i := 1 to pred(size) do begin
gotoxy(2, 2 + i); write((i*step div 1024):4, 'Kb: ');
for j := 1 to Trunc(arr[i]*mult_by) do write(chr(178-byte(odd(i))));
gotoxy(72, 2 + i); write(arr[i]:4);
end;
end;
var
i : byte;
begin
clrscr;
FillChar(sizes, sizeof(sizes),0);
GetFiles('*.*','c:\', sizes);
writeln;
Gyst(sizes, Succ(maxDegree));
ReadLn;
end.
не забываем пользоваться тегами !