日期:2014-05-17  浏览次数:21125 次

fSO 删除单一的文件不会,帮忙解决!

下面一个列表,想不要的点删除就删掉,不会做,高手,就在上面做出来,
<%
Const   MaxPerPage=20
const   UpFileType_pic= "jpg|gif|bmp|png "
const   UpFileType_flash= "swf "
const   UpFileType_media= "wmv|asf|avi|mpg "
const   UpFileType_rm= "ram|rm|ra "
Const   SaveUpFilesPath= "../upimages "  
dim   strFileName
dim   Action
dim   totalPut,CurrentPage,TotalPages
dim   UploadDir,TruePath,fso,theFolder,theFile,thisfile,FileCount,TotalSize,TotalSize_Page
dim   DialogType,strUpFileType,strFileType,FileID
DialogType= "pic "
strFileName= "e2.asp?DialogType= "   &   DialogType
Action=trim(Request( "Action "))

if   request( "page ") <> " "   then
        currentPage=cint(request( "page "))
else
currentPage=1
end   if
select   case   DialogType
case   "pic "
strUpFileType=UpFileType_pic
case   "flash "
strUpFileType=UpFileType_flash
case   "media "
strUpFileType=UpFileType_media
case   "rm "
strUpFileType=UpFileType_rm
case   else
strUpFileType= " "
end   select


if   right(SaveUpFilesPath,1) <> "/ "   then
UploadDir= " "   &   SaveUpFilesPath   &   "/ "
else
UploadDir= " "   &   SaveUpFilesPath
end   if
TruePath=Server.MapPath(UploadDir)

%>

<html>
<head>
<title> 从已上传文件选择 </title>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<link   href= "mt_style.css "   rel= "stylesheet "   type= "text/css ">
</head>
<body   leftmargin= "2 "   topmargin= "0 "   marginwidth= "0 "   marginheight= "0 ">
<%
If   not   IsObjInstalled( "Scripting.FileSystemObject ")   Then
Response.Write   " <b> <font   color=red> 你的服务器不支持   FSO(Scripting.FileSystemObject)!   不能使用本功能 </font> </b> "
Else
set   fso=CreateObject( "Scripting.FileSystemObject ")
call   main()
end   if

sub   main()
if   fso.FolderExists(TruePath)=False   then
response.write   "找不到文件夹!可能是配置有误! "
exit   sub
end   if

FileCount=0
TotalSize=0
Set   theFolder=fso.GetFolder(TruePath)
For   Each   theFile   In   theFolder.Files
strFileType=lcase(mid(theFile.Name,instrrev(theFile.Name, ". ")+1))
if   instr(strUpFileType,strFileType)> 0   then
FileCount=FileCount+1
TotalSize=TotalSize+theFile.Size
end   if
next
if   FileCount=0   then
response.write   " <p> &nbsp; </p> <p> &nbsp; </p> <p   align= 'center '> 没有找到任何 "   &   DialogType   &   "文件! </p> "
exit   sub
end   if
totalPut=FileCount
if   currentpage <1   then
currentpage=1
end   if
if   (currentpage-