asp教程生成目录与无限生成多级目录创建
这里提供二款asp目录生成函数第一款是只能创建一级目录后一款函数可以支持多目录同时生成
sub efolder(foldername)
dim fso
set fso=servercreateobject("scriptingfilesystemobject")
if fsofolderexists(servermappath(foldername)) then
set fso=nothing
exit sub
else
fsocreatefolder(servermappath(foldername))
end if
set fso=nothing
end sub
===================================================================
sub arrayfolder(pathsep)
dim arraypathepathnewpath
arraypath = split(pathsep)
newpath=""
for each epath in arraypath
newpath=newpath&epath&"/"
newpath = replace(newpath"//""/")
efolder newpath
next
end sub
arrayfolder "//""/"
生成多级目录
建立目录的程序如果有多级目录则一级一级的创建
function createdir(byval localpath)
on error resume next
localpath = replace(localpath"""/")
set fileobject = servercreateobject("scriptingfilesystemobject")
patharr = split(localpath"/")
path_level = ubound(patharr)
for i = to path_level
if i= then pathtmp=patharr() & "/" else pathtmp = pathtmp & patharr(i) & "/"
cpath = left(pathtmplen(pathtmp))
if not fileobjectfolderexists(cpath) then fileobjectcreatefolder cpath
next
set fileobject = nothing
if errnumber <> then
createdir = false
errclear
else
createdir = true
end if
end function%>