您的位置:首页网页设计ASP实例 → 简单的文件目录浏览源程序

简单的文件目录浏览源程序

时间:2009/12/16 10:38:00来源:本站整理作者:我要评论(0)

简单的文件目录浏览源程序

    '**************************************
    ' Name: File / Directory Viewer
    ' Description:This Will Display All The
    '     Files, File Size and file date of every
    '     file in the directory you specify.
    To make this work, paste the code into your favorite html editor, save it and Then view it.
    ' By: Thomas Michael
    '
    '
    ' Inputs:None
    '
    ' Returns:None
    '
    'Assumes:File System Object Be Needed :)
    '     and it is setup to look for you my docum
    '     ents folder at "c:\mydocu~1" but you can
    '     change the line of code to look in any d
    '     irectory.
    '
    'Side Effects:None
    '
    'Warranty:
    'code provided by Planet Source Code(tm)
    '     (http://www.Planet-Source-Code.com) 'as
    '     is', without warranties as to performanc
    '     e, fitness, merchantability,and any othe
    '     r warranty (whether expressed or implied
    '     ).
    'Terms of Agreement:
    'By using this source code, you agree to
    '     the following terms...
    ' 1) You may use this source code in per
    '     sonal projects and may compile it into a
    '     n .exe/.dll/.ocx and distribute it in bi
    '     nary format freely and with no charge.
    ' 2) You MAY NOT redistribute this sourc
    '     e code (for example to a web site) witho
    '     ut written permission from the original
    '     author.Failure to do so is a violation o
    '     f copyright laws.
    ' 3) You may link to this code from anot
    '     her website, provided it is not wrapped
    '     in a frame.
    ' 4) The author of this code may have re
    '     tained certain additional copyright righ
    '     ts.If so, this is indicated in the autho
    '     r's description.
    '**************************************
    
    <%@ LANGUAGE="VBSCRIPT" %>
    <% Option Explicit %>
    <HTML>
    <HEAD> <TITLE>File Viewer</TITLE> </HEAD>
    <BODY>
    <TABLE width="100%" border=1 bordercolor="#000000" align="left" cellpadding="2" cellspacing="0">
    <TR align="left" valign="top" bgcolor="#000000">
     <TD width="65%"><FONT color="#FFFFFF"><B><FONT size="2" face="Verdana, Arial, Helvetica, sans-
serif">Title</FONT></B></FONT></TD>
    <TD width="10%"><FONT color="#FFFFFF"><B><FONT size="2" face="Verdana, Arial, Helvetica, sans-
serif">Size</FONT></B></FONT></TD>
    <TD width="25%"><FONT color="#FFFFFF"><B><FONT size="2" face="Verdana, Arial, Helvetica, sans-
serif">Date</FONT></B></FONT></TD>
    </TR>
    <%
     'File System Object
     Dim objFSO
     'File Object
     Dim objFile
     'Folder Object
     Dim objFolder
     'String To Store The Real Path
     Dim sMapPath
     'Create File System Object To Get list of files
     Set objFSO = CreateObject("Scripting.FileSystemObject")
     'Get The path For the web page and its dir.
     'change this setting To view different directories
     sMapPath = "C:\Mydocu~1"
     'Set the object folder To the mapped path
     Set objFolder = objFSO.GetFolder(sMapPath)
     'For Each file In the folder
     For Each objFile In objFolder.Files
     %>
     <TR align="left" valign="top" bordercolor="#999999" bgcolor="#FFFFFF">
     <TD> <FONT size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"><A href="<% =
sMapPath & "/" & objFile.Name %>">
     <%
     'write the files name
     Response.Write objFile.Name
     %>
     </A>
     </FONT>
     </TD>
    <TD>
     <FONT size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">
    
     <%
     'We will format the file size so it looks pretty
     If objFile.Size <1024 Then
     Response.Write objFile.Size & " Bytes"
     ElseIf objFile.Size < 1048576 Then
     Response.Write Round(objFile.Size / 1024.1) & " KB"
     Else
     Response.Write Round((objFile.Size/1024)/1024.1) & " MB"
     End If
     %>
     </FONT>
     </TD>
    <TD>
     <FONT size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">
     <% 'the files Date
     Response.Write objFile.DateLastModified
     %>
     </FONT>
     </TD>
     </FONT>
     </TD>
     </TR>
     <%
     Next
     %>
    </TABLE>
    </BODY>
    </HTML>

 

相关阅读 Chrome浏览器新老版本插件安装教程 谷歌浏览器新老版本插件安装方如何禁止谷歌浏览器隐藏url的www前缀 禁止chrome浏览器隐藏url的uc浏览器怎么扫码谷歌浏览器怎么安装离线插件 Chrome浏览器安装.crx离线插件教程谷歌浏览器商店打不开怎么办 Chrome应用商店进不去解决方法uc下载的视频在哪QQ浏览器拍照识题怎么用 QQ浏览器拍照识题教程QQ浏览器小程序免流量吗 QQ浏览器小程序免流量说明

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 迅雷新手完全入门手册 asp下面javascript上传图片限制格式大小方法告诉大家网页弹出窗口应用总结ASP常见错误类型大全asp常见错误分析和解决办法

人气排行 总是弹出visual studio 实时调试器 三种解决SQLSERVER存储过程及调用详解Asp获取真实IP地址ASP中连接Mssql的几种方法一个简单好用的UBB编辑器(含代码)如何用Split将字符串转换为数组并获取数组下ASP防止表单重复提交的办法告诉你免费的简单聊天室源代码