ASP statistics file space size code

Source: Internet
Author: User
Tags filetime trim

Dim Fso,fsofile,filetype,filesize,filetime,path
Dim Dir
Action=trim (Request ("Action"))
Set fso=server.createobject ("Scripting.FileSystemObject")
Iserr
If Action = "Del" Then
Call Delall
Else
Dir=trim (Request.QueryString ("Dir"))
Path = Server.MapPath (uploadfolder) & Dir
Set fsofile = Fso.getfolder (Server.MapPath (Uploadfolder))
Fsofilesize = Fsofile.size ' Space size statistics
Set fsofile = Nothing
Set fsofile = Fso.getfolder (Path)

Response.Write ("<table class= ' table ' cellspacing= ' 1 ' cellpadding= ' 3 ' width= ' 98% ' align= ' center ' border= ' 0 ' >") &vbcrlf
Response.Write ("<tr>") &vbcrlf
Response.Write ("<td width= ' 80% ' class= ' Hback ' > main catalogue: ...") &UploadFileDir& "&nbsp;&nbsp; space Occupancy:")
Response.Write GetFileSize (Fsofilesize)
Response.Write ("&nbsp;&nbsp;<br/> Current directory: <a href= ' admin_upfiles.asp ' title= ' return home directory" ><font Color= ' #FF0000 '. </font></a><font color= ' #0000FF ' > ' &Dir& ' </font>&nbsp;&nbsp; occupancy Space: ')
Response.Write GetFileSize (Fsofile.size)
Response.Write ("&nbsp;&nbsp; includes <font color= ' #FF0000 ' >" &FsoFile.SubFolders.count& "</ font> folders; &nbsp;&nbsp;<font color= ' red ' ><b> ' &FsoFile.Files.count& ' </b>< /FONT> Files </td> ") &vbcrlf
Response.Write ("</tr>") &vbcrlf
Response.Write ("</table>") &vbcrlf
Response.Write ("<form name= ' form ' method= ' post ' action= '?") Action=del ' style= ' margin:0 ' > ') &vbcrlf
Response.Write ("<table class= ' table ' cellspacing= ' 1 ' cellpadding= ' 3 ' width= ' 98% ' align= ' center ' border= ' 0 ' >") &vbcrlf
Response.Write ("<tr class= ' Xingmu ' height= ' >") &vbcrlf
Response.Write ("<th width= ' 10% ' height= ' align= ' center ' class= ' Xingmu ' > Check </th>") &vbcrlf
Response.Write ("<th width= ' 30% ' align= ' center ' class= ' XINGMU ' > File/folder name </th>") &vbcrlf
Response.Write ("<th width= ' 10% ' align= ' center ' class= ' Xingmu ' > Type </th>") &vbcrlf
Response.Write ("<th width= ' 15% ' align= ' center ' class= ' xingmu ' > File size </th>") &vbcrlf
Response.Write ("<th align= ' center ' class= ' Xingmu ' > Last modified Time </th>") &vbcrlf
Response.Write ("</tr>") &vbcrlf

For each dirfolder in Fsofile.subfolders
Foldername=dirfolder.name
Foldersize=getfilesize (Dirfolder.size)
Foldertime=dirfolder.datelastmodified

Response.Write ("<tr onmouseover= ' Overcolor (this) ' onmouseout= ' Outcolor (this) ' >") &vbcrlf
Response.Write ("<td align= ' center ' class= ' hback ' > <input type= ' checkbox ' name= ' FolderID ' value= '" "& foldername& "' onclick=" "Checkitem (This, ' Chkall ')" "></td>") &vbcrlf
Response.Write ("<td align= ' left ' class= ' hback ' >&nbsp;<a href=?action=open&dir= '" &Dir& ") &FolderName& ">" &FolderName& "</a></td>") &vbcrlf
Response.Write ("<td align= ' center ' class= ' hback ' ></td> ') &vbcrlf
Response.Write ("<td align= ' center ' class= ' hback ' >" &FolderSize& "</td>") &vbcrlf
Response.Write ("<td align= ' left ' class= ' Hback ' >" &FolderTime& "</td>") &vbcrlf
Response.Write ("</tr>") &vbcrlf

Next
For each dirfiles in Fsofile.files
Filename=dirfiles.name
Filetype=getfileicon (FileName)
Filesize=getfilesize (Dirfiles.size)
Filetime=dirfiles.datelastmodified

Response.Write ("<tr onmouseover= ' Overcolor (this) ' onmouseout= ' Outcolor (this) ' >") &vbcrlf
Response.Write ("<td align= ' center ' class= ' hback ' > <input type= ' checkbox ' name= ' Fileid ' value= '" "& filename& "' onclick=" "Checkitem (This, ' Chkall ')" "></td>") &vbcrlf
Response.Write ("<td align= ' left ' class= ' hback ' >&nbsp;<a href= '" &UploadFolder&Dir& "/" &FileName& "' target= ' _blank ' >" &FileName& "</a></td>") &vbcrlf
Response.Write ("<td class= ' hback ' align= ' center ' ></td> ') &vbcrlf
Response.Write ("<td align= ' center ' class= ' hback ' >" &FileSize& "</td>") &vbcrlf
Response.Write ("<td align= ' left ' class= ' Hback ' >" &FileTime& "</td>") &vbcrlf
Response.Write ("</tr>") &vbcrlf

Next
Response.Write ("</table>") &vbcrlf
Response.Write ("<table width= ' 98% ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 0 ' align= ' center ' >") &vbcrlf
Response.Write ("<tr>") &vbcrlf
Response.Write ("<td width= ' 10% ' align= ' center ' ><input type= ' checkbox ' name= ' checkall ' value= ' checkbox ') Onclick= "" Checkall (This, ' Fileid ') "" ></td> ") &vbcrlf
Response.Write ("<td colspan= ' 4" height= ' >&nbsp;<input name= ' Del ' type= ' Submit ' class= ' Button ' id= ') Del ' style= ' cursor:hand ' value= ' delete ' onclick= ' {if (Confirm (' OK to delete selected file or folder!? ') {this.document.form.submit (); return true;} return false;} "" >&nbsp;&nbsp;<input type= ' hidden ' name= ' thisdir ' value= ' "&Dir&" ' >&nbsp;&nbsp; <input name= ' AA ' type= ' button ' class= ' button ' id= ' AA ' value= ' returns to the picture catalog ' onclick= ' "javascript:window.location.href=" Admin_upfiles.asp '; ' " ></td> ") &vbcrlf
Response.Write ("</tr>") &vbcrlf
Response.Write ("</table>") &vbcrlf
Response.Write ("</form>") &vbcrlf

End If
Set fsofile = Nothing
Set Fso = Nothing

Related Article

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.