-
您的位置:首页 → 技术开发 → ASP技巧 → ASP文件操作--列出目录及文件
ASP文件操作--列出目录及文件
时间:2004/11/7 4:10:00来源:本站整理作者:蓝点我要评论(0)
-
把以下文件建在同一目录,IIS中确定文件操作组件可用,即可用ASP列出文件和目录了,呵呵欢迎光临我的主页 http://skypavilion.yeah.net
----文件folder.inc-----
<%
folderini="c:\"
%>
----文件index.asp-----
FileSearch
----文件up.asp-----
Up
----文件getinfo.asp-----
<%foldinfo=trim(Request.Querystring("foldinfo"))%>
GetInfo
Current Folder:--<%=foldinfo%> |
|
Folder Name: |
Size: |
LastModify: |
|
<%
upfolder=left(foldinfo,len(foldinfo)-1)
upfolder=left(upfolder,InstrRev(upfolder, "\"))
if foldinfo<>folderini then
response.write("Parent Folder")
else
response.write("Parent Folder")
end if%>
|
<% ShowFolderList(foldinfo) %>
|
File Name: |
Size: |
LastModify: |
|
<% showfolderinfo(foldinfo)%>
|
|
<%
Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s, schild,p,fsize
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
s = f1.name
's = s & vbCrLf
p = f1.DateLastModified
fsize = f1.Size
schild=folderspec&s&"\"
Response.write("")
Response.write("")
Response.write("0"&s&" | ")
Response.write(""&fsize&" | ")
Response.write(""&p&" | ")
Response.write("
")
Response.write("
")
Next
End Sub
Sub showfolderinfo(folderspc)
set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyFolder=MyFileObject.GetFolder(folderspc)
for each thing in MyFolder.Files
'Response.write("
"&thing)
'===============Get file information
Set afile=MyFileObject.GetFile(thing)
'==========filename correct code
filenamecode=afile.name
filedetail=folderspc+filenamecode
filedetail=replace(filedetail,"\","*s_p_l_i_t*")
filesize=afile.size
lastmodify=afile.DateLastModified
Response.write("")
Response.write("")
Response.write("<"&filenamecode&" | ")
Response.write(""&filesize&" | ")
Response.write(""&lastmodify&" | ")
Response.write("
")
Response.write("
")
Next
End sub
%>
----文件fileinfo.asp-----
<%
filename=Request.QueryString("filename")
filename=replace(filename,"*s_p_l_i_t*","\")
filesize=Request.QueryString("filesize")
lastmodify=Request.QueryString("lastmodify")
%>
<%
'Response.write filename&"
"&filesize&"
"&lastmodify
%>
Current File Info: |
File Location: |
< <%=filename%> |
|
File Size: |
<%=filesize%> bytes |
|
LastModify: |
<%=lastmodify%> |
|
Please Use appropriate Application to Open this File.
|
Close
Window |
相关阅读
Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么
-
热门文章
没有查询到任何记录。
最新文章
VB.NET 2005编写定时关
Jquery get/post下乱码解决方法 前台gbk gb如何使用数据绑定控件显示数据ASP脚本循环语句ASP怎么提速
人气排行
轻松解决"Server Application Error"和iis"一起学习DataGridView调整列宽用ASP随机生成文件名的函数Jquery get/post下乱码解决方法 前台gbk gbODBC Drivers错误80004005的解决办法返回UPDATE SQL语句所影响的行数的方法用Javascript隐藏超级链接的真实地址两个不同数据库表的分页显示解决方案
查看所有0条评论>>