tamaño de carpeta
Código PHP:
/********************************************************************************/
/* FUNCION PARA SACAR EL TAMAÑO DEL HDD DE UNA CARPETA */
/********************************************************************************/
function FUNC_sizeCarpeta($dir) {
$dh = opendir($dir);
$size = 0;
while (($file = readdir($dh)) !== false)
if ($file != "." and $file != "..") {
$path = $dir."/".$file;
if (is_dir($path))
$size += dirsize($path);
elseif (is_file($path))
$size += filesize($path);
}
closedir($dh);
$size = number_format($size/1024,3);
return $size;
}
//////////////////////////////////////////////////////////////////////////////////
quota de la web
Código PHP:
/********************************************************************************/
/* FUNCION PARA SACAR LA QUOTA DEL HDD DEL SERVIDOR+NUMERO DE FICHEROS/CARPETAS */
/********************************************************************************/
function FUNC_sizeDomainQuota($quota){ //FUNC_sizeDomainQuota($quota=25);
function obsah($adr,&$totalquota,&$dir,&$size){
$dp = OpenDir($adr);
do{
$itm = ReadDir($dp);
if (Is_Dir("$adr/$itm")&&($itm!=".")&&($itm!="..")&&($itm!="")){
obsah("$adr/$itm",$totalquota,$dir,$size);
$dir++;
}
elseif (($itm!=".")&&($itm!="..")&&($itm!="")){
$size = $size + FileSize("$adr/$itm");
$totalquota++;
}
} while ($itm!=false);
CloseDir($dp);
}
obsah(".",$totalquota,$dir,$size);
$freeA = $size/1024*1024;
$freeA = $freeA/1024;
$freeA = $freeA/1024;
$exp = explode(".",$freeA);
$freeN = substr($exp[1],0,2);
$freeA = $exp[0].".".$freeN;
$freeB = $quota-$freeA;
$datosQuote = "Tamaño del Portal: <B>$freeA</B> Mbytes - Quota del Portal: <B>$quota</B> Mbytes<br>Espacio Libre: <B>$freeB</B> Mbytes - Ocupado por <B>$totalquota</B> ficheros y <B>$dir</B> carpeta\s";
return $datosQuote;
}
//////////////////////////////////////////////////////////////////////////////////