The function of the size of the PHP statistics directory file
this function can recursively traverse all files in the directory and calculate the total file size in MB.
[code]
.lt;? Php
recycle all the files in the directory, and the size of the directory and file size
$dirName=.quot; phpMyAdmin.quot;
$dir=opendir ($dirName); returns a resource type
while. EName! =.quot;..quot;.Amp;.Amp; $fileName! =.quot; quot;) {
if. Br/.gt;.Quot;
}
else{
echo.Quot;.Lt; font color='green'.gt;.Quot;.$fileName..Quot. }
closedir ($dir);
convert the size of a file or directory into a easy to read way
function toSize ($size) {
$dw; Ize.gt; pow (2,20)) {
$dw=.quot; MB.quot;
$size=round ($size/pow (2,20), 2);
}
>; R / > function dirSize ($dirName) {
$dirsize=0;
$dir=opendir ($dirName);
while / > {/ / 1]
if (is_dir ($file)) {
$dirsize =dirSize ($file);
}
$dirsize / > >;