Home | Advertising Info4 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Monday, April 29, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Code Samples
 PowerASP Code Help Area : Classic ASP - Code Samples
Subject Info: Show Directory Size A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: April/27/2004 at 8:14pm | IP Logged Quote cwilliams

Show The Size Of A Directory Using ASP

This is an example of using the FileSystemObject to determine the total size of all files in a directory and any sub directories in it. This is handy because sometimes you might want to know just how big your web site is. Replace "somedirectory" with your directory name. If you know the physical path you can replace Server.MapPath("/somedirectory") with the actual path like so.
"E:\Inetpub\virtuals\somesite\somedirectory"

Here's the catch.
If you are using NT the directories you run this on must have the correct permissions. Basically the directories and all subdirectories within it all need "read" permissions from the anonymous account or you will get a permission denied error.

<%
Set MyFileSize = Server.CreateObject ("Scripting.FileSystemObject")
MyPath = Server.MapPath("/somedirectory")
Set MyFolder = MyFileSize.GetFolder(MyPath)
%>


<p><% =MyPath %> is <% =MyFolder.Size %> bytes</p>

The results might look something like this.

E:\Inetpub\virtuals\somesite\somedirectory is 47331 bytes



__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com