function TamanoCarpeta(const Carpeta:string):Integer;
var S:TSearchRec;
begin
Result:=0; //default
if (FindFirst(IncludeTrailingBackslash(Carpeta)+'*.*', faAnyFile, S)=0) then
repeat
Inc(Result, S.Size);
until (FindNext(S)<>0)
else
Result:=-1;
FindClose(S)
end;