Tamaño de Carpetas
...en ASP
Fernando Neicun O
Zone Web
Con este nuevo script que hemos desarrollado podremos ver el tamaño de una carpeta determinada por ti. Este script trabaja con el File System Object.
Desarrollo:
En esta ocación te pasaremos el codigo completo, con el HTML tambien.
<%
'Capturamos el nombre del script con los servers variables.
script_name=request.servervariables("script_name")
split_name=split(script_name,"/")
' Ponemos nºs en la carpeta con niveles bajando
num_directory=ubound(split_name)-1
%>
<html>
<title>Tamaño de la carpeta</title>
<body>
<table align="center">
<tr>
<td width=150>
<b>Carpeta</b>
</td>
<td width=150>
<b>Megabytes</b>
</td>
<td width=150>
<b>Kilobytes</b>
</td>
<td width=150>
<b>Bytes</b>
</td>
</tr>
<%
set directory=server.createobject("scripting.filesystemobject")
set allfiles=directory.getfolder(server.mappath("../"& split_name(num_directory)& "/"))
for each directory in allFiles.subfolders
if right(directory.Name,3) <> "cnf" then
' Agregamos la carpetacon su tamaño
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
next
%>
<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>
|
 |
 |
 |
|