不知道有没有现成的函数,但可以自己编程递归搜索。<br>下面的例子稍加改动就棵实现你想要的功能。<br>function GetDirectorySize(Path: String): Integer; //eg. Path = 'c:/temp/'<br>var<br> SR: TSearchRec;<br>begin<br> Result := 0;<br> if path[length(path)]<>'/' then path:=path+'/';<br> if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then<br> begin<br> if (sr.Name <> '.') and (sr.Name <> '..') and (sr.Attr = faDirectory) then<br> Result := Result + GetDirectorySize(Path+Sr.Name+'/')<br> else<br> Result := Result + Sr.Size;<br> while FindNext(sr) = 0 do<br> if (sr.Name <> '.') and (sr.Name <> '..') and (sr.Attr = faDirectory) then<br> Result := Result + GetdirectorySize(Path+Sr.Name+'/')<br> else<br> Result := Result + Sr.Size;<br> FindClose(sr);<br> end;<br>end;