Ver Mensaje Individual
  #13 (permalink)  
Antiguo 13/03/2007, 12:35
Avatar de estibaliz2006
estibaliz2006
 
Fecha de Ingreso: noviembre-2006
Mensajes: 439
Antigüedad: 17 años, 5 meses
Puntos: 1
Re: tamaños de directorios (cuanto ocupa lo que hay dentro)

sí, pero nada. al final he conseguido obtenerlo con otras dos funciones: la primera, me lee el directorio y me dice el tamaño, y con la segunda, transformo los bytes en MB, GB...

las funciones que hago son:

Código PHP:
function dirsize($path,$buf=2){ 
static 
$buffer
if(isset(
$buffer[$path])) 
return 
$buffer[$path]; 
if(
is_file($path)) 
return 
filesize($path); 
if(
$dh=opendir($path)){ 
$size=0
while((
$file=readdir($dh))!==false){ 
if(
$file=='.' || $file=='..'
continue; 
$size+=dirsize($path.'/'.$file,$buf-1); 

closedir($dh); 
if(
$buf>0
$buffer[$path]=$size
return 
$size

return 
false

la segunda funcion
Código PHP:
function humansize ($bytes){ 
$position 0
$units = array(" bytes"" Kb"" Mb"" Gb"" Tb" ); 
while( 
$bytes >= 1024 && ( $bytes 1024 ) >= ) { 
$bytes /= 1024
$position++; 


return 
round ($bytes1) . $units[$position]; 

y luego,

Código PHP:
while ($row=mysql_fetch_array($cnx))

{

$nombre "".$row['nombre']."";

$apellidos "".$row['apellidos']."";    

$email "".$row['email'].""
$path "modulos/$nombre";
$tamano humansize (dirsize ("$path")); 

echo (
"".$apellidos.", ".$nombre." -".$email."-".$tamano);

y por fin funciona....

gracias por todo, Fridureiks. un 10 en atención y preocupación por mi problema...