- UID
- 2031431
- 威望
- 27 点
- 金钱
- 2 金币
- 点卡
- 10 点
|
计算文件夹大小
- <style>
- input,body{font-family:verdana; font-size:12px; background-color:#fcfcfc}
- </style>
- <?php
- function dirsize($dir)
- {
- $handle=opendir($dir);
- $size = 0;
- while ( $file=readdir($handle) )
- {
- if ( ( $file == "." ) || ( $file == ".." ) ) continue;
- if ( is_dir("$dir/$file") )
- $size += dirsize("$dir/$file");
- else
- $size += filesize("$dir/$file");
- }
- closedir($handle);
- return $size;
- }
- if ( !IsSet($dirname) )
- {
- echo "<form action=$PHP_SELF method=post name=delform><center><font color=red>Folder</font>: <input name=dirname style="color:red"> <input type=submit></center></form>";
- echo " <SCRIPT> document.delform.dirname.focus() </SCRIPT> ";
- }
- else
- {
- $msg = sprintf("size of "$dirname" is: <font color=red>%d</font> byte(s)<P>", dirsize($dirname) );
- echo "<center>$msg</center>";
- }
- ?>
复制代码 |
哈哈哈!!!!你的IP是不是?我都知道了!!! |
|