My webhost doesn't offer an interface that i can see which folders are consuming probably the most quantity of space what exactly I am searching for is one thing which will show me how big each folder inside my primary folder recursively, I'm not sure of anything on the web, and did a couple of searches however emerged without any results. This can be a Light server having a CGI-Bin so nearly all PHP script should work or something that works within the CGI-Bin.
The function "getDirectorySize" will ignore link/shorcuts to files/directory. The function "sizeFormat" will suffix the dimensions with bytes,KB,Megabytes or GB accordingly.
function getDirectorySize($path) amplifier&lifier $file != '..' &lifier&lifier !is_link ($nextpath)) elseif (is_file ($nextpath)) closedir ($handle) $total['size'] = $totalsize $total['count'] = $totalcount $total['dircount'] = $dircount return $total function sizeFormat($size) else if($size<(1024*1024)) else if($size<(1024*1024*1024)) Megabytes" else
$path="/httpd/html/pradeep/" $ar=getDirectorySize($path) echo "<h4>Details for that path : $path</h4>" echo "Total size : ".sizeFormat($ar['size'])."<br>" echo "No. of files : ".$ar['count']."<br>" echo "No. of sites : ".$ar['dircount']."<br>"
Particulars for that path : /httpd/html/pradeep/ Total size : 2.9 Megabytes No. of files : 196 No. of sites : 20
For those who have spend access you are able to run the command
$ du -h
or possibly make use of this, if PHP is set up to permit execution:
<?php $d = escapeshellcmd(dirname(__FILE__)) echo nl2br(`du -h $d`) ?>