存档
< %
set FSO = Server.CreateObject("Scripting.FileSystemObject")
Function CheckFile(byval Path)
pathArr = Split(Path,"/")
Path = replace(Path,"/" & pathArr(ubound(pathArr)),"")
if Path = "" then Exit Function
if not FSO.FolderExists(Server.Mappath(Path)) then
Call CheckFile(Path)
FSO.CreateFolder(Server.Mappath(Path))
end if
End Function
Function newFile(byval Path)
if Right(Path,1)="/" then
Path = Path & "index.html"
end if
Call CheckFile(Path)
Set newFile = FSO.CreateTextFile(Server.Mappath(Path))
End Function
set n = newFile("/index/cat2/path/demo/111/222/333/444/555/666/777/888/")
n.write "12345"
n.close
set n = nothing
set n = newFile("../../../../test.css")
n.write "body{}"
n.close
set n = nothing
%>