现在的位置: 首页 > 综合 > 正文

getdirsize

2014年03月26日 ⁄ 综合 ⁄ 共 374字 ⁄ 字号 评论关闭
function getdirsize(dir: string; subdir: boolean): longint;
var
rec: TSearchRec;
found: integer;
begin
result := 0;
if dir[length(dir)] '/' then dir := 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 (subdir = true) then
inc(result, getdirsize(dir + rec.Name, true));
found := findnext(rec);
end;
findclose(rec);
end;

抱歉!评论已关闭.