//试试下面这个函数<br>function GetDirectorySize(const ADirectory: string): Integer;<br>var<br> Dir: TSearchRec;<br> Ret: integer;<br> Path: string;<br>begin<br> Result := 0;<br> Path := ExtractFilePath(ADirectory);<br> Ret := Sysutils.FindFirst(ADirectory, faAnyFile, Dir);<br> if Ret <> NO_ERROR then exit;<br> try<br> while ret = NO_ERROR do<br> begin<br> inc(Result, Dir.Size);<br> if (Dir.Attr in [faDirectory]) and (Dir.Name[1] <> '.') then<br> Inc(Result, GetDirectorySize(Path + Dir.Name + '/*.*'));<br> Ret := Sysutils.FindNext(Dir);<br> end;<br> finally<br> Sysutils.FindClose(Dir);<br> end;<br>end;