教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp生成目录与无限生成多级目录创建

asp生成目录与无限生成多级目录创建

发布时间:2016-09-26   编辑:jiaochengji.com
教程集为您提供asp生成目录与无限生成多级目录创建等资源,欢迎您收藏本站,我们将为您提供最新的asp生成目录与无限生成多级目录创建资源
这里提供二款asp目录生成函数,第一款是只能创建一级目录,后一款函数可以支持多目录同时生成。
<blockquote>sub efolder(foldername)
dim fso
set fso=server.createobject("scripting.filesystemobject")
if fso.folderexists(server.mappath(foldername)) then
set fso=nothing
exit sub
else
fso.createfolder(server.mappath(foldername))
end if
set fso=nothing
end sub
</blockquote>

'===================================================================

<blockquote>

sub arrayfolder(path,sep)
dim arraypath,epath,newpath
arraypath = split(path,sep)
newpath=""
for each epath in arraypath
newpath=newpath&epath&"/"
newpath = replace(newpath,"//","/")
efolder newpath
next
end sub

arrayfolder "1/2/3","/"

'生成多级目录

'建立目录的程序,如果有多级目录,则一级一级的创建
function createdir(byval localpath)
on error resume next
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%>

</blockquote>

您可能感兴趣的文章:
asp生成目录与无限生成多级目录创建
php利用mkdir()函数创建多级目录
ASP基础
php使用mkdir创建多级目录的方法
asp与asp.net的session共享
php fopen 创建生成html并且创建目录实例教程
php session实现多级目录存放
asp实现的代码批量修改程序
php中mkdir的使用方法介绍
win2003安全设置教程(伪装篇)

[关闭]
~ ~