<
%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
act=request("act")
select case act
case "del"
Del()
case else
Show()
end select
function Del()
files=trim(request("fs"))
files=replace(files,",",":")
files=replace(files,",","\")
on error resume next
Set Sys = Server.CreateObject("Scripting.FileSystemObject")
If Sys.FileExists(files) Then
Sys.DeleteFile(files)
end if
if err then
response.write "<script>alert('无法删除指定文件,请联系管理员以手动方式删除!');window.history.back();</script>"
else
response.write "<script>alert('文件删除成功!');window.location='filemanage.asp';</script>"
end if
end function
function Show()
fs=request("fs")
if fs<>"" then
folderspec=fs&"\"
else
folderspec="E:\WebSite\"
end if
'锁定目录
if len(folderspec)<len("E:\WebSite\") then
folderspec="E:\WebSite\"
end if
set fs=createobject("scripting.filesystemobject")
set f=fs.getfolder(folderspec)
set fd=f.subfolders
%>
<link href="cssStyle/main.css" rel="stylesheet" type="text/css">
<style>
body
{
background-color:#FFFFFF;
}
</style>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolorlight="#555555" bordercolordark="#F3F3F3">
<tr>
<td height="25" bgcolor="#ECE9D8">当前路径:<%=folderspec%></td>
</tr>
</table>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolorlight="#555555" bordercolordark="#F3F3F3">
<tr>
<th height="23" colspan="2">文件名</th>
<th>文件大小</th>
<th>文件类型</th>
<th>创建日期</th>
<th>文件管理</th>
</tr>
<%
for each whatever in fd
%>
<tr >
<td width="23" height="23"><a href="filelist.asp?fs=<%=folderspec%>&<%=whatever.name%>"><img src="images/folder.gif" width="20" height="20" border="0"></td>
<td><a href="?fs=<%=folderspec&whatever.name%>"><%=whatever.name%></a></td>
<td><%=whatever.size%></td>
<td><%=whatever.type%></td>
<td><%=whatever.DateCreated %></td>
<td> </td>
</tr>
<%next
set fc=f.files
for each whatever in fc
%>
<tr >
<td width="23" height="23"><a href="filelist.asp?fs=<%=folderspec%>&<%=whatever.name%>"><img src="images/file.gif" width="20" height="20" border="0"></td>
<td height="23"><%=whatever.name%></td>
<td><%=int(whatever.size/1024)+1%> KB</td>
<td><%=whatever.type%></td>
<td><%=whatever.DateCreated %></td>
<td>
<%
url=replace(folderspec,"E:\WebSite\","")
url=replace(url,"\","/")
fos=replace(folderspec&whatever.name,"\",",")
fos=replace(fos,":",",")
%>
<a href="
http://www.xxx.com/<%=url%><%=whatever.name%>" target="_blank">查看</a> | <a href="#" >删除</a>
</td>
</tr>
<%
next
%>
</table>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolorlight="#555555" bordercolordark="#F3F3F3">
<tr>
<td height="25" bgcolor="#FFFFFF">
<%
str="?fs="&folderspec
If InstrRev(str, "\") > 1 Then
str=Left(str, InstrRev(str, "\") - 1)
End If
If InstrRev(str, "\") > 1 Then
str=Left(str, InstrRev(str, "\") - 1)
End If
%>
<a href="<%=str%>">返回上一级</a></td>
</tr>
</table>
<%end function%>
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set Files = FSO.GetFile("c:\HONDA.jpg")
%>
<font color=red>[<%=Files.Name%>]</font>文件的全部属性:
<Br>名称:<%=Files.Name %>
<Br>路径:<%=Files.Path %>
<Br>驱动器:<%=Files.Drive %>
<Br>大小:<%=Files.size %>
<Br>类型:<%=Files.type %>
<Br>属性:<%=Files.Attributes %>
<Br>创建日期:<%=Files.DateCreated %>
<Br>上次进入日期:<%=Files.DateLastAccessed %>
<Br>上次修改日期:<%=Files.DateLastModified %>
<br>文件的父文件夹:<%=Files.ParentFolder%>
<br>文件短文件名:<%=Files.ShortName%>
<br>短路径名:<%=Files.ShortPath%>
[此贴子已经被作者于2008-11-28 13:37:57编辑过]