1
Hello would like to know how I can show the total size of a directory and I need the script to be in a folder called status and show the data of the format/hd folder/.
I found this code below with everything it only shows the occupied space if the file is inside the directory. Someone could help me.
<?php
$bytes = disk_free_space(".");
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
echo 'Espaço total do FTP da pasta formatos/hd/ '. sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . '<br />';
?>
Do you need the total size of the directory or the free disk space? Because the disk_free_space() function returns the free space and not the occupied space.
– bruno
In case then eats would be to put the space occupied ?
– Striffer