国内风投公司排名:ASP如何实现 ASP程序生成目录

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 00:33:25
如何实现 ASP程序生成目录,我的音乐网,想在每个专集生成一个目录,目录里面存放一个专集网页,
批量生成 htm网页的,有两个网页 所生成
第一个 Make_musiclist.asp 第二个 make_musiclistall.asp

给你个函数吧:
'// 建立目录的程序,如果有多级目录,则一级一级的创建
'// 建立目录的程序,如果有多级目录,则一级一级的创建
function FSOCreateDIR(LocalPath)
dim patharr,path_level,i,pathtmp,cpath,CreateDIR,FileObject
on error resume next
LocalPath = Server.MapPath(LocalPath)
LocalPath = replace(LocalPath,"\","/")
set FileObject = server.createobject("Scripting.FileSystemObject")
patharr = split(LocalPath,"/")
path_level = ubound(patharr)
for i = 0 to path_level
if i=0 then pathtmp = patharr(0) & "/" else pathtmp = pathtmp & patharr(i) & "/"
cpath = left(pathtmp,len(pathtmp)-1)
if not FileObject.FolderExists(cpath) then FileObject.CreateFolder(cpath)
next
set FileObject = nothing
if err.number<>0 then
CreateDIR = false
err.Clear
else
CreateDIR = true
end if
end function

调用的时候这样调用:

如果路径:"/web/html/"

那么调用:FSOCreateDIR "/web/html/"
就OK了

记得不要用物理路径,用虚拟路径

用FSO对象...