FSO操作文件系统(9)


    theInstalledObjects(2) = "MSWC.NextLink"
    theInstalledObjects(3) = "MSWC.Tools"
    theInstalledObjects(4) = "MSWC.Status"
    theInstalledObjects(5) = "MSWC.Counters"
    theInstalledObjects(6) = "IISSample.ContentRotator"
    theInstalledObjects(7) = "IISSample.PageCounter"
    theInstalledObjects(8) = "MSWC.PermissionChecker"
    theInstalledObjects(9) = "Scripting.FileSystemObject"
    theInstalledObjects(10) = "adodb.connection"
    theInstalledObjects(11) = "SoftArtisans.FileUp"
    theInstalledObjects(12) = "SoftArtisans.FileManager"
    theInstalledObjects(13) = "JMail.SMTPMail"
    theInstalledObjects(14) = "CDONTS.NewMail"
    theInstalledObjects(15) = "Persits.MailSender"
    theInstalledObjects(16) = "LyfUpload.UploadFile"
    theInstalledObjects(17) = "Persits.Upload.1"
Dim fso
If  IsObjInstalled(theInstalledObjects(9)) Then 
Set fso =Server.CreateObject("Scripting.FileSystemObject")
End If 
Function IsObjInstalled(strClassString)
 On Error Resume Next
 IsObjInstalled = False
 Err = 0
 Dim xTestObj
 Set xTestObj = Server.CreateObject(strClassString)
 If 0 = Err Then IsObjInstalled = True
 Set xTestObj = Nothing
 Err = 0
End Function
'检查组件版本
Public Function getver(Classstr)
 On Error Resume Next
 Dim xTestObj
 Set xTestObj = Server.CreateObject(Classstr)
 If Err Then
  getver=""
 else 
   getver=xTestObj.version
 end if
 Set xTestObj = Nothing
End Function
'效验名称
Function IsvalidFileName(File_Name)
 IsvalidFileName = False
 Dim re,reStr
 Set re=new RegExp
 re.IgnoreCase =True
 re.Global=True
 re.Pattern="[^_\.a-zA-Z\d]"
 reStr=re.Replace(File_Name,"")
 If File_Name = reStr Then IsvalidFileName=True
 Set re=Nothing
End Function
'文件写入
Function writeto(xmlfloder,xmlfile,content,mode)
writeto=false
If Not IsObjInstalled(theInstalledObjects(9)) Then Exit Function 
mode=killint(mode,0,0,2)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3693.html