熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp生成目錄與無限生成多級目錄創建

2022-06-13   來源: .NET編程 

  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%>


From:http://tw.wingwit.com/Article/program/net/201311/14291.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.