Well, a folder takes 4k in size by default. This is the minimum size of an entry in the VOC.
( Volume Of Contents ) It is without anything inside it. Once you add files to that folder, it will have a new size based on the items inside it.
Not sure what you are asking. Do you want PHP code that can calculate size of a folder?
If it is a Windows server, you can use this routine ( From StackOverflow )
<?PHP
$f = 'f:/www/docs';
$obj = new COM ( 'scripting.filesystemobject' );
if ( is_object ( $obj ) )
{
$ref = $obj->getfolder ( $f );
echo 'Directory: ' . $f . ' => Size: ' . $ref->size;
$obj = null;
}
else
{
echo 'can not create object';
}
?>
But, if it is a Linux hosting server, you can use this:
<?PHP
$f = './path/directory';
$io = popen ( '/usr/bin/du -sk ' . $f, 'r' );
$size = fgets ( $io, 4096);
$size = substr ( $size, 0, strpos ( $size, "\t" ) );
pclose ( $io );
echo 'Directory: ' . $f . ' => Size: ' . $size;
?>
You would need to enter the folder you are checking on of course with the correct path to it.
Now, you could use a recursive folder like the PHP RecursiveDirectoryIterator() function or one of the others available to check the size of all folders in a root folder. Hope this helps…