您的位置:首页-> 资讯中心-> 网络编程-> ASP技术-> 怎样才能将服务器端文件夹下的文件,按文件建立的时间先后排序?
ASP技术
ASP技术
.Net专区
数据库类
JSP
本类阅读TOP10
·ASP对excel的操作。
·问题
·如何利用回车来进行焦点转移呢?
·ASP操作Excel技术总结
·在ASP中怎樣用Excel寫報表
·如何用asp调用启动服务器上的Exe程序。
·利用XMLHTTP的国际域名查询系统源代码(一个页面,无需另外组件,原帖另附QQ在线状态检测)
·用VB编写ActiveX DLL实现ASP编程
·在第一个输入框输入完以后,回车如何自动转移到第二个输入框在焦点呢?
·ASP如何获取真实IP地址
广告连接
精选专题
怎样才能将服务器端文件夹下的文件,按文件建立的时间先后排序?
作者:未知 来源:未知 加入时间:2003-9-2

不使用数据库,怎样才能将服务器端文件夹下的文件,按文件建立的时间先后排序?现在已经可以列出所有的文件,但不能排序

dir_name="abc"
Set fso = CreateObject("Scripting.FileSystemObject")
set self_path = fso.getfile(server.mappath(Request.ServerVariables("PATH_INFO")))
files_path=self_path.ParentFolder.ParentFolder
folderspec=files_path+"\"+dir_name
Set f = fso.GetFolder(folderspec)

Set fc = f.Files
For Each f1 in fc
response.write f1.name&"<br>"
next
---------------------------------------------------------------

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Function getFileInfo(filespec)'获取文件名和创建(修改)时间
Dim fs, f
dim s(1)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s(0) = "文件名" & f.Name & "<br>创建时间: " & f.DateCreated & "<br>"
s(1)=f.DateCreated
getFileInfo=s
End Function

Sub compositor(s0,s1)'冒泡排序
dim j,x
j=0
For i=0 to UBound(s1)
  For j=0 to UBound(s1)-j
    If Cint(Cdate(s1(i))-Cdate(s1(j)))>0 Then
     x=s1(i)
    s1(i)=s1(j)
    s1(j)=x
     x=s0(i)
    s0(i)=s0(j)
    s0(j)=x
    End If
  Next
Next
for i=0 to UBound(s0)
  response.Write(s0(i))
next
End Sub

dir_name="abc"
Set fso = CreateObject("Scripting.FileSystemObject")
set self_path = fso.getfile(server.mappath(Request.ServerVariables("PATH_INFO")))
files_path=self_path.ParentFolder.ParentFolder
folderspec=files_path&"\"+dir_name
Set f = fso.GetFolder(folderspec)

Set fc = f.Files
dim myFile(),fileCreateDate()
i=0
For Each f1 in fc
redim preserve myFile(i)
  redim preserve fileCreateDate(i)
myFile(i)=getFileInfo(files_path&"\"+dir_name&"\"&f1.name)(0)
fileCreateDate(i)=cdate(getFileInfo(files_path&"\"+dir_name&"\"&f1.name)(1))
i=i+1
next
compositor myFile,fileCreateDate
%>


相关软件
  • 服务器监视 MyIIS Monitor WEB方式控制和查看IIS服务器
  • 遥志代理服务器(CCProxy) 6.61 简体中文版 架设代理服务器软件
  • CS服务器登陆和管理工具 3.7.10.30 简体中文版 用来替代HLSW
  • AngelMail邮件服务器 v2.8 界面友好,操作简单,功能强大
  • 腾讯通服务器RTX 2006 面向企业用户的即时通信软件
  • 简易http服务器(IIS) V1.2.100 提供静态网页、文件或图片下载服务
  • 箫心Web个人临时共享服务器 1.5.12.16 标准版 利用反向代理突破内网的技术
  • 遥志邮件服务器 CMailServer V5.4.0 绿色共享版 互联网邮件服务器软件
  • 遥志代理服务器(CCProxy) V6.39
  • CMailServer邮件服务器 V5.38
  • 相关文章
  • 个人电脑变网站服务器全面解决方案
  • ASP中如何获取服务器的名称