CodeAve.com CodeAve.com - ASP - Server Variables
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Disk Space Usage
One of the most important things that webmasters need to track is their disk space utilization. The amount of space that your site is taking up on the server is often times the only real difference in the price of many web-hosting packages. If your site exceeds your hosting package plan space allocation there is usually a disproportionate price paid for the additional disk space as opposed the per megabyte price paid for the hosting package. All hosting companies should provide a simple way to access how much space your site is utilizing SoftComca.com (The host of CodeAve.com) does others do not. This script can be placed in virtually any asp directory and will read the size of all subordinate directories. If placed in the top level of a virtual you may need to make revisions to the server.mappath statement.
View the Output
Text View
Print View
Mail this Link
Download the Code

<%
'Capture the name of the page as well as directory structure 
script_name=request.servervariables("script_name")

'Split the directory tree into an arry by /
split_name=split(script_name,"/")

' Sets the number of directory levels down
num_directory=ubound(split_name)-1

%>

<html>
<title>CodeAve.com(Directory Size)</title>
<body bgcolor="#FFFFFF">

<table align="center">
<tr>
<td width=150>
<b>Directory</b>
</td>
<td width=150>
<b>Megabytes</b>
</td>
<td width=150>
<b>Kilobytes</b>
</td>
<td width=150>
<b>Bytes</b>
</td>
</tr>
<%
' Create a file system object to read all the directories
' beneath the current directory split_name(num_directory)
' You can hard code the directory name if you like
set directory=server.createobject("scripting.filesystemobject")
set allfiles=directory.getfolder(server.mappath("../"& split_name(num_directory)& "/"))

' Lists all the files found in the directory
for each directory in allFiles.subfolders
' Removes certain MSFrontPage was directories 
if right(directory.Name,3) <> "cnf" then 
'Adds the folder sizes up for a total
total_size=total_size + directory.size %>


<tr>
<td width=150>
<%= directory.name %>
</td>
<td width=150><%= formatnumber((directory.size/1024/1024),2) %></td>
<td width=150><%= formatnumber((directory.size/1024),0) %></td> 
<td width=150><%= formatnumber(directory.size,0) %></td> 
</tr>
<% end if 'end check for FrontPage directories 
next 'end of the for next loop %>

<tr>
<td width=150><b>Total</b></td>
<td width=150><%= formatnumber((total_size/1024/1024),2) %></td>
<td width=150><%= formatnumber((total_size/1024),0) %></td> 
<td width=150><%= formatnumber(total_size,0) %></td> 
</tr>
</table>

</body>
</html>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3