Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

Want to know Where your Space Went

Code Wizard, 12-30-2006

Have you ever wanted to know Where your space went, either on your hosting account, your personal computer, your server, well stop thinking, start seeing... With this script, you can see the size of folders, the size of files, works fines on windows and unix.....easy to configure.... What Else could you ask for?

<?php
/*
ChangeLog
0.01(5 July 4:30am)
- Release
0.02(5 July 5:09am)
- Added Top Links

Instructions Delete me after
First off goto http://newbienetwork.net/phpcodems.php?as=viewcode&id=7
put the developer timer on your site, this will just make it easier to
tell how long it takes the script to execute, very helpful this class,
then you copy my code into a .php goto the url of the file, and see where
your space go's.....

Once you have check it out, all i ask is that you email me, or even add a
comment here, and tell me what you think, Pass it around, why keep the
advantage of this script to your self, when you can tell some one else, they
tell another person, they come up with an idea to improve it, so then the idea
gets back to me, gets put in the script, and everyone benfits....

Thats all I ask Give feekback and Pass the word about script...

- James "ReDucTor" Mitchell
<sjdtmv@tpg.com.au>
*/
?>



<html>
<body><a name="top">Script</a> by <a href="mailto:sjdtmv@tpg.com.au">James "ReDucTor" Mitchell</a><?php
include("class.timer.php");
$timer = new timer(viewfiles);
$timer->start_timing();
$foldertoview = ".";
$SecondsToTimeout = 120;
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>)<sup><a href="#top">Top</a></sup><br>
";
}
}
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><sup><a href="#top">Top</a></sup>
";
showdir($dir."/".$file, 1);
}
if($mode == 0){
echo "<a href="#".realpath($dir."/".$file).""><b>".$file."</b></a> (<i>".convert($totalsize,"mbytes")."</i>)<br>
";
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>
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions