Free Webspace - Calculating Used Amount / Space Remaining

Web hosting, FTP/database access, mirror services and hosted blogs
Post Reply
Thy_Zombie!
Posts: 61
Joined: Thu Mar 03, 2005 1:26 pm
Location: Central Coast (NSW)

Free Webspace - Calculating Used Amount / Space Remaining

Post by Thy_Zombie! » Fri Nov 16, 2007 9:34 pm

.
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!
.

austdata
Posts: 629
Joined: Wed Apr 25, 2007 12:38 am
Location: Melbourne

Re: Free Webspace - Calculating Used Amount / Space Remainin

Post by austdata » Fri Nov 16, 2007 10:47 pm

G'day Thy_Zombie!,
Have you tried opening a DOS window and keying in ftp home.exetel.com.au, 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.

Cheers,

Mike

Thy_Zombie!
Posts: 61
Joined: Thu Mar 03, 2005 1:26 pm
Location: Central Coast (NSW)

Post by Thy_Zombie! » Sat Nov 17, 2007 3:18 pm

.
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!
.

User avatar
ymo
Posts: 292
Joined: Sat Sep 10, 2005 4:36 pm
Location: Wollongong NSW

Post by ymo » Sat Nov 17, 2007 5:08 pm

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" "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>

Thy_Zombie!
Posts: 61
Joined: Thu Mar 03, 2005 1:26 pm
Location: Central Coast (NSW)

Post by Thy_Zombie! » Sat Nov 17, 2007 8:23 pm

.
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!
.

jpurssey
Posts: 24
Joined: Wed Nov 21, 2007 9:25 am
Location: NSW
Contact:

Re: Free Webspace - Calculating Used Amount / Space Remainin

Post by jpurssey » Sat Sep 22, 2012 5:57 am

Bump.

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

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

Re: Free Webspace - Calculating Used Amount / Space Remainin

Post by Dazzled » Sat Sep 22, 2012 7:38 am

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 http://www.textheavy.com/tutorials/winftp.html. 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 :
#!/bin/bash
lftp -u user,password home.exetel.com.au << EOF
du -ah
bye

EOF

jpurssey
Posts: 24
Joined: Wed Nov 21, 2007 9:25 am
Location: NSW
Contact:

Re: Free Webspace - Calculating Used Amount / Space Remainin

Post by jpurssey » Mon Sep 24, 2012 7:06 pm

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.
John

Post Reply