How Much Web Space left?

Web hosting, FTP/database access, mirror services and hosted blogs
Post Reply
leithant
Posts: 46
Joined: Mon Mar 06, 2006 7:21 pm

How Much Web Space left?

Post by leithant » Tue May 11, 2010 11:52 am

How do I check the above, please?

Leith

Dazzled
Volunteer Site Admin
Posts: 6003
Joined: Mon Nov 13, 2006 1:16 pm
Location: Sydney

Re: How Much Web Space left?

Post by Dazzled » Tue May 11, 2010 12:03 pm

There are a few tricks- one way if you only have Windows is to put this in your site, call it sitesize.php, and navigate to it (it works on all systems) and get a count in bytes:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>webspace size</title>
</head>

<body background="#FFF">
<?php
// function du written by Gregor Mosheh on 17-Jul-2003 03:25
// version 1.01 written by psylogic
// just run this script and it will return the current size of your webspace in bytes

function du($location) {
if (!$location or !is_dir($location)) {
return 0;
}

$total = 0;

$all = opendir($location);
while ($file = readdir($all)) {
  if (is_dir($location.'/'.$file) and $file <> ".." and $file <> ".") {
  $total += du($location.'/'.$file);
  unset($file);
}
elseif (!is_dir($location.'/'.$file)) {
  $stats = stat($location.'/'.$file);
  $total += $stats['size'];
unset($file);
}
}
closedir($all);
unset($all);
return $total;
}
?> 

<div style="background-color:#ccc;">
<?php
print du(getcwd());
?> 
<br />
<br />
<?php
print getcwd();
?>
<br />
</div>
</body>
</html>

If you use Linux, just mount your site folder and use the normal file facilities. On Ubuntu it's Places->Connect to Server, or even easier: Baobab (Disk usage analyser) and press the remote folder icon, like this (for a site with 2 folders and 93 MB used) -
Attachments
Screenshot-19.png
Baobab
Screenshot-19.png (31.04 KiB) Viewed 1070 times

Post Reply