[转帖]关于FSO删除文件或文件夹
关于FSO删除文件或文件夹dim fso=server.createobject("script.fileSystemObject") if fso.folderexists(Server.MapPath(filename)) then fso.deleteFolder(Server.MapPath(filename)) end if 删除文件 if fso.FileExists(Server.MapPath(filename)) then fso..DeleteFile(Server.MapPath(filename)) end if 删除文件函数: Function DeleFile(FilePath) On Error Resume Next Set Del=Server.CreateObject("Scripting.FileSystemObject") if Err <> 0 Then DelFile="该空间不支持FSO组件或者文件路径错误!" else if InStr(FilePath, ",") > 0 then FilePath=Split(FilePath,",") For i = 0 to ubound(FilePath) If Del.FileExists(Server.MapPath(FilePath))=True Then Del.DeleteFile Server.MapPath(FilePath(i)),true Next Else If Del.FileExists(Server.MapPath(FilePath))=True Then Del.DeleteFile Server.MapPath(FilePath),true End if End if Set Del=Nothing End Function