Einzelnen Beitrag anzeigen

omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#6

Re: Verzeichnisgröße gerechnet wenn Verzeichnis >2GB ist

  Alt 16. Aug 2008, 20:41
Korrektur...

Delphi-Quellcode:
{-----------------------------------------------------------}
function GetDirSize(dir: string; subdir: Boolean): Int64;
{-----------------------------------------------------------}
var
  rec: TSearchRec;
  found: Integer;
  iSize : int64:
begin
  Result := 0;
  if dir[Length(dir)] <> '\then
    dir := dir + '\';
  found := FindFirst(dir + '*.*', faAnyFile, rec);
  while found = 0 do
  begin
    Int64Rec(iSize).Hi := Rec.FindData.nFileSizeHigh;
    Int64Rec(iSize).Lo := Rec.FindData.nFileSizeLow;
    Inc(Result, iSize);
    if (rec.Attr and faDirectory > 0)
       and (rec.Name <> '.')
       and (rec.Name <> '..')
       and subdir then
    begin
      Inc(Result, GetDirSize(dir + rec.Name, True));
    end;
    found := FindNext(rec);
  end;
  FindClose(rec);
end; {GetDirSize}
  Mit Zitat antworten Zitat