<!--#include file="conn.asp"-->
<!--#include file="inc/cook1.asp"-->
<!--#include file="inc/dimflag.asp" -->
<!--#include file="file_err.asp"-->
<!--#include file="top.asp"-->
<div id="container">
<%
filepath=request("filepath")
filesize=request("filesize")
delfilename=request("delfilename")
action=request("action")

if filepath="" then
SaveUpFilesPath="../upload_files"
else
SaveUpFilesPath=filepath
end if

if len(filepath)<=16 then
strFileName="file.asp"
else
strFileName="file_upload.asp"
end if


dim totalPut,CurrentPage,TotalPages
dim UploadDir,TruePath,fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize
if right(SaveUpFilesPath,1)<>"/" then
UploadDir=""& SaveUpFilesPath & "/"
else
UploadDir=""& SaveUpFilesPath
end if
%>

<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><img src="images/but_3.gif" alt="删除"  onclick="form1.action='#'; ConfirmDel() "></li>
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
</div>
<%
select case action
case "del"
if filesize>0 then
response.write "<div class='tablesearch'>文件夹不为空，无法删除！【<a href=file.asp?filepath="&UploadDir&" >返回</a>】</div>"
else
call DeleteFolder(delfilename)
response.write"<script>alert(""文件夹删除成功!"");location.href=""file.asp?filepath="&filepath&""";</script>"
'response.Redirect "file.asp?filepath="&filepath&""
end if

case ""
TruePath=Server.MapPath(UploadDir)
If not IsObjInstalled("Scripting.FileSystemObject") Then
Response.Write "<b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></b>"
Else
set fso=CreateObject("Scripting.FileSystemObject")
if request("Action")="Del" then
whichfile=server.mappath(Request("FileName"))  
Set thisfile = fso.GetFile(whichfile)  
thisfile.Delete True
end if

response.Write "<div class='tablesearch'> 文件夹路径 :"&TruePath&"，" 
if fso.FolderExists(TruePath)then
FileCount=0
TotleSize=0
Set theFolder=fso.GetFolder(TruePath)
For Each theFile In theFolder.SubFolders   
FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
next
totalPut=FileCount
response.write "本页共显示 <b>" & FileCount & "</b> 个文件夹，占用 <b>" & TotleSize\1024 & "</b> K"
else
response.write "找不到文件夹！可能是配置有误！"
end if
response.Write "</div>"
end if

call showContent 

end select
%>

<%
sub showContent()
%>  
<div class="tableAll titlebgcolor">
 <li style="width:30px">&nbsp;</li>
 <li style="width:50px">操作</li>
 <li style="width:200px">文件夹名</li>
 <li style="width:200px">文件大小</li>
 <li style="width:200px">文件类型</li>
 <li style="width:200px">最后修改时间</li>
 <li style="width:50px">删除</li>
</div>
<%
For Each theFile In theFolder.SubFolders
%>
<div class="tableAll trbgcolor">
 <li style="width:30px">&nbsp;</li>
 <li style="width:50px"><a href="<%=strFileName%>?filepath=<%=UploadDir & theFile.Name%>">打开</a></li>
 <li style="width:200px"><%=theFile.Name%></li>
 <li style="width:200px"><%=theFile.size%>字节</li>
 <li style="width:200px"><%=theFile.type%></li>
 <li style="width:200px"><%=theFile.DateLastModified%></li>
 <li style="width:50px">&nbsp;&nbsp;<a href="file.asp?action=del&filesize=<%=theFile.size%>&filepath=<%=UploadDir%>&delfilename=<%=UploadDir & theFile.Name%>" onclick="return ConfirmDel()" >删除</a></li>
</div>
<%
Next
%>
<%end sub%>  
</div>
<%
Sub DeleteFolder(strFolder)
    '首选判断要建立的文件夹是否已经存在
    Dim strTestFolder,objFSO	
    strTestFolder = Server.Mappath(strFolder)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    ' 检查文件夹是否存在
    If objFSO.FolderExists(strTestFolder) Then
     objFSO.DeleteFolder(strTestFolder)
    Else
     response.write "<font color=red>该文件夹不存在！</font>"
    End If
    Set objFSO = Nothing
End Sub  
%>
<!--#include file="footer.asp"-->