Page 1 of 1

Free Webspace - Calculating Used Amount / Space Remaining

Posted: Fri Nov 16, 2007 9:34 pm
by Thy_Zombie!
A quick one for the eXeTeL'ers

I suppose this question is twofold:

1) Is there a simple way to find out how much space, of the 200MB allocated, that I have used? I mean, apart from ftp'ing my entire site back to my local PC and making my calculations locally.

2) I've been mucking around with Coppermine Photo Gallery and I'm not going to pretend that I know too much about PHP & MySQL but this DB must also grow in size. Does the size of the DB add to my 200MB limit?

Looking forward to your response.

- TZ!

Re: Free Webspace - Calculating Used Amount / Space Remainin

Posted: Fri Nov 16, 2007 10:47 pm
by austdata
G'day Thy_Zombie!,
Have you tried opening a DOS window and keying in ftp, your phone number for the user name and the password associated with your web space. Then type DIR and it will show a total space used.

Other than that, I don't have a clue.



Posted: Sat Nov 17, 2007 3:18 pm
by Thy_Zombie!
Thanx Mike

Tried your suggestion but I only get the following output (after the directory listing is complete), which I think is just communication stats:

ftp: 3213 bytes received in 0.03Seconds 103.65Kbytes/sec.

Had a quick look at other available dos ftp commands but none seemed useful? Although there prolly is a 'switch' for one of these commands that may give me some useful data :?

Thanx anyway Mike.

- TZ!

Posted: Sat Nov 17, 2007 5:08 pm
by ymo
I cannot find where this was answered before but a couple of little PHP programs were listed that do the trick. Try the following - save it as usage.php or similar in your web space.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<title>webspace size</title>
<body background="#FFF">
// 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);
elseif (!is_dir($location.'/'.$file)) {
$stats = stat($location.'/'.$file);
$total += $stats['size'];
return $total;
<div style="background-color:#ccc;">
print du(getcwd());
<br />
<br />
print getcwd();
<br />

Posted: Sat Nov 17, 2007 8:23 pm
by Thy_Zombie!
Thanx ymo, as basic as the results are (in bytes) this does the trick, as you say ;)

If anyone else has a script/tool/prog that generates a slightly more detailed report, please feel free to add to this thread.

Thanx again ymo, appreciate your post!

- TZ!

Re: Free Webspace - Calculating Used Amount / Space Remainin

Posted: Sat Sep 22, 2012 5:57 am
by jpurssey

I am wondering if, after nearly five years, whether there is a simpler method to show Webspace used.

Re: Free Webspace - Calculating Used Amount / Space Remainin

Posted: Sat Sep 22, 2012 7:38 am
by Dazzled
Since for security reasons we don't have direct access to Exetel's computer system, except on the ftp interface, or via the user website on a browser, we can get the used space from either of these approaches:

1. Browser Method:
Place on the site an inline script within a web page that can crawl the directories, obtain the information and return it to the browser. The Mosheh PHP script above is a little under 1k bytes, simple and suitable; or

2. FTP method.
Hard core types can enter and interrogate the server using the command line in a terminal (they know how already) or else:
Use a GUI client like Filezilla (which can clank away "adding to queue" until the result shows up in the corner); or:
If you have a Linux machine you can just go there and treat the site much as a local disc (within FTP's limitations). In that case Baobab (the GUI disk usage analyser) just tells you.

To sum up, for Linux users the problem hardly arises, and Windows users can use one of the clients that can search directories, like Filezilla, or else insert a PHP script in the site to return the space used.

PS: For a simple site, the Windows prompt/command line FTP method is described at Exetel returns a listing from the ls command for each directory.

PPS This shell script will do the trick if you are automating something (du -ab lists files in bytes, du -h gives directories in MB, try also du -ah. Change as required). The total usage is at the end of the output :
lftp -u user,password << EOF
du -ah


Re: Free Webspace - Calculating Used Amount / Space Remainin

Posted: Mon Sep 24, 2012 7:06 pm
by jpurssey
OK. Mosheh's webpage works, thanks.

As no-one has mentioned using php disk_total_space ( string $directory ) I suppose we don't have permissions to use this command.