Home | Advertising Info166 USERS CURRENTLY ONLINE   
   Site Search Contact Us Wednesday, April 26, 2017  
 
 







DISCUSSION ARCHIVES
DISCUSSION ARCHIVES 2
DISCUSSION ARCHIVES 3
BLOG

 
Try a free httpZip trial now and compress for less!


We didn't realize
the site was so popular.

Other Stuff
 
 


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

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright 1998 - 2017 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.

Active Server Pages ASP a directory of ASP tutorials applications scripts components and articles for the novice to professional developer. CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com