var DirBytes : integer; function TFileBrowser.DirSize(Dir:string):integer; var SearchRec : TSearchRec;Separator : string;begin if Copy(Dir,Length(Dir),1)='\' thenSeparator := ''elseSeparator := '\';if FindFirst(Dir+Separator+'*.*',faAnyFile,SearchRec) = 0 then beginif FileExists(Dir+Separator+SearchRec.Name) then beginDirBytes := DirBytes + SearchRec.Size;{Memo1.Lines.Add(Dir+Separator+SearchRec.Name);}end else if DirectoryExists(Dir+Separator+SearchRec.Name) then beginif (SearchRec.Name<>'.') and (SearchRec.Name<>'..') then beginDirSize(Dir+Separator+SearchRec.Name);end;end;while FindNext(SearchRec) = 0 do beginif FileExists(Dir+Separator+SearchRec.Name) then beginDirBytes := DirBytes + SearchRec.Size;{Memo1.Lines.Add(Dir+Separator+SearchRec.Name);}end else if DirectoryExists(Dir+Separator+SearchRec.Name) thenbeginif (SearchRec.Name<>'.') and (SearchRec.Name<>'..') then beginDirSize(Dir+Separator+SearchRec.Name);end;end;end;end;FindClose(SearchRec);end; |