Peter
<cfoutput>
<cfset folder = expandPath(".")>
#folder#<br>
#createObject("COM",
"Scripting.FileSystemObject").getFolder(folder).Size#
</cfoutput>
That will tell you how big the current folder your in is including its sub
folders in bytes.
Steve
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Mount
Sent: Friday, January 21, 2005 10:43 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Determining free space on web server
Hi
I tried the code below and it worked OK but as I'm hosting in a shared
environment I need to figure out how to see my space usage in my 30mb's
of the server. I couldn't figure out how to do it with this code but I
wound up doing a cfdirectory on each of my folders in the site and using
cfloops to add the size attribute from each cfdirectory function it to a
"totalSize" variable. This seems to work but with all the seperate
cfdirectory functions be repeated (one for each directory) it's starting
to look like spaghetti code.
Rather than using seperate cfdirectory functions is it possible to just
use one cfdirectory function in a way that takes in all the directories
on my site?
Thanks
Peter Mount
[EMAIL PROTECTED]
Kym Kovan wrote:
> Hello Peter,
>
>>
>> Is there a function to determine the amount of free space (or space
>> used) on the web server? For example, just say I wanted to check the
>> amount of space I'm using with my own domain name (or even in
>> localhost) without having to check it in an ftp program. I'm looking
>> for a function that I can use in my demo app that will display the
>> figure on the app's web pages.
>
>
> If its a winbox and scripting host is enabled then try this (the
> wrapping will probably wreck it):
>
> <cfobject type="COM" action="create"
> class="Scripting.FileSystemObject" name="Application.fso">
>
> <table align="center" cellspacing="0" cellpadding="3" border="1"
> width="100%">
> <cfset driveSpace=StructNew()>
> <cfloop collection="#Application.fso.drives#" item="curDrive">
> <!--- A DriveType of 2 indicates a fixed disk --->
> <cfif curDrive.DriveType IS 2>
> <cfset driveSpace["#curDrive.DriveLetter#"]=curDrive.availablespace>
> <tr><td><cfoutput>
> <strong>#curDrive.DriveLetter#:</strong>
> Drive has
> <strong>#ReplaceNoCase(RJustify(trim(NumberFormat(curDrive.availablespace,
> "999,999,999,999")), 15), " ", " ", "all")#</strong> Bytes
> free </cfoutput>
> </td></tr>
> </cfif>
> </cfloop>
> </table>
>
> That was a straight copy'n'paste from our management system so
> apologies for the lack of comments, quick and dirty formatting code,
> etc., :-) A more complete version could show the space taken by a
> directory, eg by a client's site.
>
>
> BTW, Peter, as you and I are the oldest CF developers in this part of
> the world you might appreciate a little history we threw up on the
> home page of our management system:
>
> http://k2o.mbcomms.net.au/
>
> Tale a peek at the CF bit, I think I have got it right (got frustrated
> this arvo and knocked it up in a hurry), yell if there is anything I
> can add......
>
> --
> yours,
>
> Kym
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
>
>
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/