<% Function CreateFolder(strPath) On Error Resume Next Dim FSO,arrPath,pathNum,i,tmpPath,currPath strPath = Server.MapPath(strPath) strPath = Replace(strPath,"\","/") arrPath = Split(strPath,"/") pathNum = Ubound(arrPath) Set FSO = Server.CreateObject("Scripting.FileSystemObject") If Err<>0 Then Response.Write("创建文件夹"&strPath&"失败,可能您的系统不支持FSO!") Response.End() End If For i = 0 To pathNum If i=0 Then tmpPath=arrPath(0) & "/" Else tmpPath = tmpPath & arrPath(i) & "/" End If currPath = Left(tmpPath,Len(tmpPath)-1) If Not FSO.FolderExists(currPath) Then FSO.CreateFolder currPath Next Set FSO = Nothing End Function
Function CreateFile(filename,filecontent) On Error Resume Next Dim fso,thisfile Set fso = CreateObject("Scripting.FileSystemObject") If Err<>0 Then Response.Write("写入文件"&filename&"失败,可能您的系统不支持FSO!") Response.End() End If Set thisfile = fso.CreateTextFile(Server.MapPath(filename), True) thisfile.write(filecontent) thisfile.close Set thisfile = nothing Set fso = nothing End Function %> |