ASP displays all files in the directory and displays the file size

Source: Internet
Author: User

Set Fso=server.createobject ("Scripting.FileSystemObject")
Set F = Fso.getfolder (SPP)
Set FC = F.subfolders
I=1
I2=1
For each F in fc%>
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "1" bgcolor= "#ffffff" >
<tr bgcolor= "#ffffff" >
&LT;TD width= "20%" bgcolor= "#fbf4f4" >&nbsp; <%=f.name%> Folders </td>
&LT;TD width= "80%" bgcolor= "#fbf4f4" >&nbsp;.gif" width=<% =drawbar ("" &f.name& ")%> height=10>&nbsp;
<%showspaceinfo ("" &f.name& ")%></td>
</tr>
</table>
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" >
<tr>
&LT;TD height= "2" ></td>
</tr>
</table>
<%i=i+1
If I2<10 Then
I2=i2+1
Else
I2=1
End If
Next

function to process file size

Sub Showspaceinfo (Drvpath)
Dim fso,d,size,showsize
Set Fso=server.createobject ("Scripting.FileSystemObject")
Drvpath=server.mappath (Drvpath)
Set D=fso.getfolder (Drvpath)
Size=d.size
Showsize=size & "&nbsp;byte"
If size>1024 Then
Size= (size1024)
Showsize=size & "&AMP;NBSP;KB"
End If
If size>1024 Then
Size= (size/1024)
Showsize=size & "&AMP;NBSP;MB"
End If
If size>1024 Then
Size= (size/1024)
Showsize=size & "&AMP;NBSP;GB"
End If
Response.Write "<font face=verdana>" & showsize & "</font>"
End Sub

%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.