All source code in ASP/ VbScript Ask a ASP/ VbScript Pro Discussion Forum Categories All jobs in ASP/ VbScript
Quick Search for:  in language:    
code,will,tell,much,disk,space,your,server,yo
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 281,486. lines
 Jobs: 101. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login

NEW! LEARNING CENTER
Special educational offers, white papers, webcasts, podcasts

  NEW! Download Rational Performance Tester V8 (download now)
  NEW! Download Rational Functional Tester V8 (download now)
  NEW! Download Rational Service Tester for SOA Quality V8 (download now)
  NEW! Teleconference: Quality In Action - Using Rational Quality Manager with Functional, Performance and Web Service Testing Products (download now)
  NEW! Introducing IBM Rational AppScan Developer Edition – easing security testing by non-security professionals (download now)

 

 


Latest postings for ASP/ VbScript.
Click here to see a screenshot of this code!Mess Officer Management System (Sistem Pengurusan Mess Pegawai)
By Mohd Fauzi on 11/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

Disk Space Usage

Print
Email
 
VB icon
Submitted on: 7/9/2000 9:55:32 PM
By: Magnus Simonarson  
Level: Intermediate
User Rating: By 2 Users
Compatibility:ASP (Active Server Pages), HTML, VbScript (browser/client side)

Users have accessed this code 10701 times.
 
author picture
(About the author)
 
     This code will tell you how much disk space on your server you're using
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: Disk Space Usage
    ' Description:This code will tell you ho
    '     w much disk space on your server you're 
    '     using
    ' By: Magnus Simonarson
    '
    ' Inputs:Noke
    '
    ' Returns:The disk space you're using on
    '     your server
    '
    ' Assumes:Just paste the code into an .a
    '     sp page on the root dir of your web
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=6254&lngWId=4    'for details.    '**************************************
    
    <HTML>
    <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <META name="GENERATOR" content="Microsoft FrontPage 4.0">
    <META name="ProgId" content="FrontPage.Editor.Document">
    <TITLE>New Page 1</TITLE>
    </HEAD>
    <BODY>
    <P><%<BR>
    'Capture the name of the page as well as
    '     directory structure <BR>
    script_name=request.servervariables("script_name")<BR>
    <BR>
    'Split the directory tree into an arry b
    '     y /<BR>
    split_name=split(script_name,"/")<BR>
    <BR>
    ' Sets the number of directory levels do
    '     wn<BR>
    num_directory=ubound(split_name)-1<BR>
    <BR>
    %><BR>
    <HTML><BR>
    <TITLE>CodeAve.com(Directory Size)</TITLE><BR>
    <BODY bgcolor="#FFFFFF"><BR>
    <BR>
    <TABLE align="center"><BR>
    <TR><BR>
    <TD width=150><BR>
    <B>Directory</B><BR>
    </TD><BR>
    <TD width=150><BR>
    <B>Megabytes</B><BR>
    </TD><BR>
    <TD width=150><BR>
    <B>Kilobytes</B><BR>
    </TD><BR>
    <TD width=150><BR>
    <B>Bytes</B><BR>
    </TD><BR>
    </TR><BR>
    <%<BR>
    ' Create a file system object to read al
    '     l the directories<BR>
    ' beneath the current directory split_na
    '     me(num_directory)<BR>
    ' You can hard code the directory name i
    '     f you like<BR>
    Set directory=server.createobject("scripting.filesystemobject")<BR>
    Set allfiles=directory.getfolder(server.mappath("../"& split_name(num_directory)& "/"))<BR>
    <BR>
    ' Lists all the files found in the direc
    '     tory<BR>
    For Each directory In allFiles.subfolders<BR>
    ' Removes certain MSFrontPage was direct
    '     ories <BR>
    if right(directory.Name,3) <> "cnf" then <BR>
    'Adds the folder sizes up for a total<
    '     ;BR>
    total_size=total_size + directory.size %><BR>
    <BR>
    <TR><BR>
    <TD width=150><BR>
    <%= directory.name %><BR>
    </TD><BR>
    <TD width=150><%= formatnumber((directory.size/1024/1024),2) %></TD><BR>
    <TD width=150><%= formatnumber((directory.size/1024),0) %></TD> <BR>
    <TD width=150><%= formatnumber(directory.size,0) %></TD> <BR>
    </TR><BR>
    <% End if 'end check For FrontPage directories <BR>
    Next 'end of the For next Loop %><BR>
    <TR><BR>
    <TD width=150><B>Total</B></TD><BR>
    <TD width=150><%= formatnumber((total_size/1024/1024),2) %></TD><BR>
    <TD width=150><%= formatnumber((total_size/1024),0) %></TD> <BR>
    <TD width=150><%= formatnumber(total_size,0) %></TD> <BR>
    </TR><BR>
    </TABLE><BR>
    <BR>
    </BODY><BR>
    </HTML></P>
    </BODY>
    </HTML>


Other 2 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/26/2001 12:36:54 AMMichael Sharp

High five, man! I've been trying to add something to a control panel (for web hosting customers) that would display the disk space they've used. This works great! Note if anyone tries to copy this code, then don't use the friendly version (not too friendly). Use the code on THIS page, but remove ALL
's because their mixed up inside the asp script (between <% and %> which was messing it up at first. So just search for
and remove it and it should work out ok. I also had to remove ../ from this line: Set allfiles=directory.getfolder(server.mappath(
(If this comment was disrespectful, please report it.)

 
1/14/2002 11:30:26 AMknowntobe

Like the previous comment I too needed something like this for a control panal. Excellent for what I needed. The only problem I had was with all the
tags which I had to remove and also had to remove "../" & from this line Set allfiles=directory.getfolder(server.mapp ath( Apart from that great work.
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2008 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.