asp读取目录下的文件

<%
Dim sPath, oFso, oFout, File
sPath = "plugin/"
Set oFso = Server.CreateObject("Scripting.FileSystemObject")
Set oFout = oFso.GetFolder(Server.Mappath(sPath))
    Response.Write "<table border='1' cellspacing='0' cellpadding='0' align='center'>" & _
    "<tr align='center'>" & _
    "<td>文件名称</td>" & _
    "<td>文件短路径名</td>" & _
    "<td>文件物理地址</td>" & _
    "<td>文件属性</td>" & _
    "<td>文件大小</td>" & _
    "<td>文件类型</td>" & _
    "<td>文件创建时间</td>" & _
    "<td>最近访问时间</td>" & _
    "<td>最近修改时间</td>" & _
    "</tr>"
    For Each File In oFout.Files
        Response.Write "<tr>" & _
        "<td>" & File.Name & "</td>" & _
        "<td>" & File.ShortPath & "</td>" & _
        "<td>" & File.Path & "</td>" & _
        "<td>" & File.Attributes & "(" & SenFe_Attributes(File.Attributes) & ")</td>" & _
        "<td>" & File.Size & "</td>" & _
        "<td>" & File.Type & "</td>" & _
        "<td>" & File.DateCreated & "</td>" & _
        "<td>" & File.DateLastAccessed & "</td>" & _
        "<td>" & File.DateLastModified & "</td>" & _
        "</tr>"
    Next
    Response.Write "</table>"
Set oFout = Nothing
Set oFso = Nothing
Function SenFe_Attributes(iType)
    Select Case iType
        Case 0 SenFe_Attributes = "Normal-普通文件, 没有设置任何属性."
        Case 1 SenFe_Attributes = "ReadOnly-只读文件,可读写."
        Case 2 SenFe_Attributes = "Hidden-隐藏文件,可读写."
        Case 4 SenFe_Attributes = "System-系统文件,可读写."
        Case 16 SenFe_Attributes = "Directory-文件夹或目录,只读."
        Case 32 SenFe_Attributes = "Archive-上次备份后已更改的文件,可读写."
        Case 1024 SenFe_Attributes = "Alias-链接或快捷方式,只读."
        Case 2048 SenFe_Attributes = "Compressed-压缩文件,只读."
    End Select
End Function
%>

时间: 2024-09-03 21:20:47

asp读取目录下的文件的相关文章

PHP读取目录下所有文件的代码_php实例

读取目录下所有文件的代码,可以不管文件名 复制代码 代码如下: <?php   $dir = "file";   // Open a known directory, and proceed to read its contents   if (is_dir($dir)) {      if ($dh = opendir($dir)) {          while (($file = readdir($dh)) !== false) {          if ($file!

asp显示目录下所有文件并显示文件大小

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&qu

读取目录下的文件得到一个数组

数组 filename=dir("盘符:\*.*") i = 0 do while filename = "" array1 (i)=filename i = i + 1 filename = dir("c:\*.*") loop VB好象也有比较好的方法,但是我不太清楚了 VBScript Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFo

PHP读取目录下所有文件,并通过ajax返回json格式的数据

php <?php // header("content-type:application/json"); //header('Content-type: text/html; charset=utf-8'); $dir = "../Music"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if($filename!="."&&$f

读取目录下的文件得到一个数组_FSO专题

filename=dir("盘符:\*.*") i = 0 do while filename = "" array1 (i)=filename i = i + 1 filename = dir("c:\*.*") loop VB好象也有比较好的方法,但是我不太清楚了 VBScript Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolde

php opendir()列出目录下所有文件的实例代码

php opendir()函数用于打开目录,通常与readdir()和closedir()函数一起用来读取目录下所有文件(即遍历目录),本文章向大家介绍php使用opendir()函数列出目录下所有文件的实例. 实例一: 使用opendir()列出目录下所有文件 <?php $dr = @opendir('/tmp/'); if(!$dr) { echo "Error opening the /tmp/ directory!<BR>"; exit; } while((

PHP中读取某个目录下的文件

<?php /*  PHP Version:  28 April 2005  Author:  move2rent  purpose:读取某个目录下的文件 */  //要读取的目录 $folder="H:/temp";  //打开目录$fp=opendir($folder);  //阅读目录while(false!=$file=readdir($fp)){//列出所有文件并去掉'.'和'..'    if($file!='.' &&$file!='..')   

C#读取目录下所有指定类型文件的方法

  本文实例讲述了C#读取目录下所有指定类型文件的方法.分享给大家供大家参考.具体分析如下: 首先要引入命名空间:using System.IO; 再写读取方法: ? 1 2 3 4 5 6 7 8 9 10 DirectoryInfo dir = new DirectoryInfo(path); //path为某个目录,如: "D:Program Files" FileInfo[] inf = dir.GetFiles(); foreach (FileInfo finf in inf

Asp.net 4.0,首次请求目录下的文件时响应很慢

原文:Asp.net 4.0,首次请求目录下的文件时响应很慢 1. 问题起因2. 尝试过的处理思路3. 解决方法   1. 问题起因     一个从VS2003(.Net Framework 1.1)升级到.net framework 4.0的项目,每次编译或者部署到服务器上后,首次请求任何一个目录下的默认页面时,都要耗时3~5秒:而以前使用.net framework 1.1的时候,没有这个问题. 我在页面上开启Trace="true"来跟踪,发现页面的处理时间并不久(IIS重启,首