函数:
sub makewjj(foldername) dim qz,temparr,i,fwjj,tempfoldername tempfoldername=foldername if len(tempfoldername)<1 then exit sub if right(tempfoldername,1)="/" then tempfoldername=left(tempfoldername,len(tempfoldername)-1) if instr(tempfoldername,"/")=0 or instr(right(tempfoldername,len(tempfoldername)-1),"/")=0 then set fso1 = createobject("scripting.filesystemobject") if not fso1.folderexists(server.mappath(tempfoldername)) then set fso12 = createobject("scripting.filesystemobject") set fwjj = fso12.createfolder(server.mappath(tempfoldername)) set fso12 = nothing end if set fso1 = nothing else if left(tempfoldername,1)="/" then qz="/" tempfoldername=right(tempfoldername,len(tempfoldername)-1) end if temparr=split(tempfoldername,"/") for i =0 to ubound(temparr) set fso1 = createobject("scripting.filesystemobject") if not fso1.folderexists(server.mappath(qz&temparr(i))) then set fso12 = createobject("scripting.filesystemobject") set fwjj = fso12.createfolder(server.mappath(qz&temparr(i))) set fso12 = nothing end if set fso1 = nothing qz=qz&temparr(i)&"/" next end if end sub
举例说明:
makewjj "www.wysjs.cn"
在当前目录创建一个文件夹,叫做www.wysjs.cn
makewjj "wysjs/wysjs2/wysjs3"
在当前目录创建三个文件夹
makewjj "/wysjs"
在根目录创建一个名为wysjs的文件夹
makewjj "/wysjs/wysjs2/wysjs3"
在根目录创建三个文件夹
依此方式,可自由在任意目录建立无限级文件夹目录