Nur so aus dem Bauch heraus, noch nicht getested da nur hier getippt...
Delphi-Quellcode:
uses System.IOUtils;
function GetDirectorySize(const Dir: string): Int64;
var
Files: TArray<string>;
SubDirs: TArray<string>;
FileSize: Int64;
i: Integer;
begin
Result := 0;
Files := TDirectory.GetFiles(Dir);
for i := 0 to High(Files) do
Result := Result + TFile.GetSize(Files[i]);
SubDirs := TDirectory.GetDirectories(Dir);
for i := 0 to High(SubDirs) do
Result := Result + GetDirectorySize(SubDirs[i]);
end;