Как определить размер каталога?
var
Form1: TForm1;
tSize: int64;
procedure TForm1.GetTotalSize( Path: string; var TotalSize: int64 );
var
sRec: TSearchRec;
isFound: boolean;
begin
isFound := FindFirst( Path + '\*.*', faAnyFile, sRec ) = 0;
while isFound do
begin
if ( sRec.Name <> '.' ) and ( sRec.Name <> '..' ) then
begin
if ( sRec.Attr and faDirectory ) = faDirectory then
GetTotalSize( Path + '\' + sRec.Name, TotalSize );
TotalSize := TotalSize + sRec.Size;
end;
isFound := FindNext( sRec ) = 0;
end;
FindClose( sRec );
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
tSize := 0;
GetTotalSize( 'C:\WINNT', tSize );
ShowMessage( IntToStr( tSize ) );
end; |