Pastas - obtendo tamanho (inclui subdir) |
Top Previous Next |
...get directory size ?
//This tip is from http://www.delphimania.de function GetDirSize(Dir: string; IncluirSubDir: Boolean = True): LongInt; var Rec : TSearchRec; Found: Integer; begin Result := 0; Dir := IncludeTrailingPathDelimiter(Dir); Found := FindFirst(Dir + '*.*', faAnyFile, Rec); while Found = 0 do begin Inc(Result, Rec.Size); if (Rec.Attr and faDirectory > 0) and (Rec.Name[1] <> '.') and (IncluirSubDir = True) then Inc(Result, GetDirSize(Dir + Rec.Name, True)); Found := FindNext(Rec); end; FindClose(Rec); end; |