ASP generation directory and unlimited generation multilevel directory creation

Source: Internet
Author: User
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

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

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", "/"

' Generate multilevel Catalogs

' Directory-building program, if there are multilevel directories, the first-level creation
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) & "/" E LSE PATHTMP = pathtmp & Patharr (i) & "/"
CPath = Left (Pathtmp,len (pathtmp)-1)
If not Fileobject.folderexis TS (cpath) then Fileobject.createfolder cpath
Next
Set fileobject = Nothing
If err.number <> 0 then
C Reatedir = False
Err.Clear
Else
Createdir = True
End If
End Function%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.