Want to know what people think of my little script(Great for Personal and Pro Use)
| From: | ReDucTor | Date: | Wed, 04 Jul 2001 18:25:20 +0000 |
| Subject: | Want to know what people think of my little script(Great for Personal and Pro Use) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56213@lists.php.net to get a copy of this message | ||
Hey,
First off grab the Developer Timer from http://newbienetwork.net/phpcodems.php?as=viewcode&id=7
thats a great little class, then make a .php file and paste the following in
<html>
<body><?php
include("class.timer.php");
$timer = new timer(viewfiles);
$timer->start_timing();
$SecondsToTimeout = 120;
$foldertoview = ".";
ini_alter(max_execution_time, $SecondsToTimeout);
function convert($bytes, $conversion)
{
$kbytes = $bytes / 1024;
$mbytes = $kbytes / 1024;
$gbytes = $mbytes / 1024;
$tbytes = $gbytes / 1024;
if($conversion == "bytes")
return round($bytes,4)." Bytes";
if($conversion == "kbytes")
return round($kbytes,3)." Kb";
if($conversion == "mbytes")
return round($mbytes,2)." Mb";
if($conversion == "gbytes")
return round($gbytes,2)." Gb";
if($conversion == "tbytes")
return round($tbytes,3)." Tb";
}
function showdir($dir, $mode)
{
echo "<blockquote>";
$handle = opendir($dir);
while (false!==($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
if($mode == 1){
if(is_file($dir."/".$file)){
// Commented out for fixing this error
echo $file."
(<i>".convert(filesize($dir."/".$file),"mbytes")."</i>)(<i>".filetype($dir."/".$file)."</i>)(<i>".fileperms($dir."/".$file)."</i>)<br>\n";
}
}
if(is_dir($dir."/".$file)){
$dirhandle = opendir($dir."/".$file);
while(false!==($filetocheck=readdir($dirhandle))){
if(!isset($totalsize))
$totalsize = filesize($dir."/".$file."/".$filetocheck);
else
$totalsize = $totalsize + filesize($dir."/".$file."/".$filetocheck);
}
if($mode == 1){
echo "<a
name=\"".realpath($dir."/".$file)."\"><b>\\".$file."</b></a>
(<i>".convert($totalsize,"mbytes")."</i>)<br>\n";
showdir($dir."/".$file, 1);
}
if($mode == 0){
echo "<a
href=\"#".realpath($dir."/".$file)."\"><b>\\".$file."</b></a>
(<i>".convert($totalsize,"mbytes")."</i>)<br>\n";
showdir($dir."/".$file, 0);
}
}
}
}
echo "</blockquote>";
}
showdir($foldertoview, 0);
?><br><br><br><br><br><?php
showdir($foldertoview, 1);
ini_restore(max_execution_time);
$timer->stop_timing();
$timer->print_runtime();
?></body></html>
Now change the $foldertoview to any folder, if you want to know the total of your system, put it as
/ that should work in unix and windows, hell i tested that on win98 system....its great, every place
that wants to know where its space is going should have it, even a little person computer should
have it to see whats going where...hehe
Tell me what you think...
- James "ReDucTor" Mitchell