Disk Space Usage
This code will tell you how much disk space on your server you're using
AI
AIサマリー: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ソースコード
<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 by /<BR>
split_name=split(script_name,"/")<BR>
<BR>
' Sets the number of directory levels down<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 all the directories<BR>
' beneath the current directory split_name(num_directory)<BR>
' You can hard code the directory name if 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 directory<BR>
for each directory in allFiles.subfolders<BR>
' Removes certain MSFrontPage was directories <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>
オリジナルのコメント (3)
Wayback Machineから復元