Thx! 🙂 The problem is that the hosting is Windows based. I have done that, if can help someone with the same problem 🙂 ->
<?
list($busySpace,$freeSpace) = calcBusyFreeSpace();
echo "Space currently being used <strong>".$busySpace."</strong> (<strong>".$freeSpace."</strong> free)<br>";
function calcBusyFreeSpace() {
$homeDir = getcwd()."\files";
exec('dir '.$homeDir, $output);
$busy = $output[count($output)-2];
$busy = split(" ",trim($busy));
$busy = str_replace(".","",$busy[count($busy)-2]);
$free = $output[count($output)-1];
$free = split(" ",trim($free));
$free = str_replace(".","",$free[count($free)-3]);
// Unitats a mostrar
if (strlen($busy)<=3) $units = ""; // Bytes
elseif (strlen($busy)<=6) $units = "KB"; // KiloBytes
elseif (strlen($busy)<=9) $units = "MB"; // MegaBytes
elseif (strlen($busy)<=12) $units = "GB"; // GigaBytes
// Convertir unitats
$busy = convert_from_bytes($busy,$units);
if ($units == "") $units = "bytes";
$busySpace = round($busy,2) . $units;
// Unitats a mostrar
if (strlen($free)<=3) $units = ""; // Bytes
elseif (strlen($free)<=6) $units = "KB"; // KiloBytes
elseif (strlen($free)<=9) $units = "MB"; // MegaBytes
elseif (strlen($free)<=12) $units = "GB"; // GigaBytes
// Convertir unitats
$free = convert_from_bytes($free,$units);
if ($units == "") $units = "bytes";
$freeSpace = round($free,2) . $units;
return array($busySpace,$freeSpace);
}
function convert_from_bytes( $bytes, $to=NULL )
{
$float = floatval( $bytes );
switch( $to )
{
case 'Kb' : // Kilobit
$float = ( $float*8 ) / 1024;
break;
case 'b' : // bit
$float *= 8;
break;
case 'GB' : // Gigabyte
$float /= 1024;
case 'MB' : // Megabyte
$float /= 1024;
case 'KB' : // Kilobyte
$float /= 1024;
default : // byte
}
unset( $bytes, $to );
return( $float );
}
?>