婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > asp中創建多級目錄的兩段代碼

asp中創建多級目錄的兩段代碼

熱門標簽:外呼回撥系統圖片 常用地圖標注范圍點 咸陽銷售外呼系統 寧夏怎么申請400電話 企數外呼系統能用多久 離線電子地圖標注軟件注冊 辦理400電話一年多少錢 蘭州智能語音電銷機器人功能 為什么外呼系統需要預存話費呢

實現代碼一、比較專業看起來

    '============================== 
    '創建多級目錄,可以創建不存在的根目錄 
    '參數:要創建的目錄名稱,可以是多級 
    '創建目錄的根目錄從當前目錄開始 
    '''調用舉例 
    ''Call CreateMultiFolder("/upload/jumbot/myphoto/") 
    '============================== 

    Function CreateMultiFolder(ByVal CFolder) 
        Dim objFSO, PhCreateFolder, CreateFolderArray, CreateFolder 
        Dim i, ii, CreateFolderSub, PhCreateFolderSub, BlInfo 
        BlInfo = False 
        CreateFolder = CFolder 
        On Error Resume Next 
        Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
        If Err Then 
            Err.Clear() 
            Exit Function 
        End If 
        If Right(CreateFolder, 1) = "/" Then 
            CreateFolder = Left(CreateFolder, Len(CreateFolder) -1) 
        End If 
        CreateFolderArray = Split(CreateFolder, "/") 
        For i = 0 To UBound(CreateFolderArray) 
            CreateFolderSub = "" 
            For ii = 0 To i 
                CreateFolderSub = CreateFolderSub  CreateFolderArray(ii)  "/" 
            Next 
            PhCreateFolderSub = Server.MapPath(CreateFolderSub) 
            If Not objFSO.FolderExists(PhCreateFolderSub) Then 
                objFSO.CreateFolder(PhCreateFolderSub) 
            End If 
        Next 
        If Err Then 
            Err.Clear() 
        Else 
            BlInfo = True 
        End If 
        CreateMultiFolder = BlInfo 
    End Function

上面的是循環

實現方法二、

'自動創建多極目錄
'code by jb51 reterry
function createit(path)
dim fsofo,cinfo,thepath,thepatharray
dim i,ii,binfo
binfo=false
thepath=path
set fsofo=createobject("scripting.filesystemobject")
if err then
err.clear
exit function
end if
thepath=replace(thepath,"\","/")
if left(thepath,1)="/" then
thepath=right(thepath,len(thepath)-1)
end if
if right(thepath,1)="/" then
thepath=left(thepath,len(thepath)-1)
end if
thepatharray=split(thepath,"/")
for i=0 to ubound(thepatharray)
createfoldersub1=createfoldersub1thepatharray(i)"/"
createfoldersub=server.mappath(createfoldersub1)
if not fsofo.folderexists(createfoldersub) then
fsofo.createfolder(createfoldersub)
end if
next
if err then
err.clear
else
binfo=true
end if
createit=binfo
end function

下面的是通過正則實現

    '============================== 
    ''創建文件目錄(多層) 
    ''使用正則 
    '============================== 

    Function Create_N_Folder(save, ByVal Path) 
        Dim Fso 
        Set Fso = Server.CreateObject("Scripting.FileSystemObject") 
        If Not Fso.FolderExists(Path) Then 
            Dim regEx 
            Set regEx = New RegExp 
            regEx.Pattern = "^(.*)\\([^\\]*)$" 
            regEx.Global = False 
            regEx.IgnoreCase = True 
            save = save  regEx.Replace(Path, "$2")  "|" 
            Path = regEx.Replace(Path, "$1") 
            If Create_N_Folder(save, Path) Then Create_N_Folder = True 
            Set regEx = Nothing 
        Else 
            If save = "|" Then 
                Create_N_Folder = True 
            Else 
                Dim Temp 
                Temp = Mid(save, 2, Len(save) - 2) 
                If InStrRev(Temp, "|") = 0 Then 
                    save = "|" 
                    Path = Path  "\"  Temp 
                Else 
                    Dim Folder 
                    Folder = Mid(Temp, InStrRev(Temp, "|") + 1) 
                    save = "|"  Mid(Temp, 1, InStrRev(Temp, "|") - 1)  "|" 
                    Path = Path  "\"  Folder 
                End If 
                Fso.CreateFolder Path 
                If Create_N_Folder(save, Path) Then Create_N_Folder = True 
            End If 
        End If 
        Set Fso = Nothing 
    End Function

以上就是asp中創建多級目錄的兩段代碼的詳細內容,更多關于asp創建多級目錄的資料請關注腳本之家其它相關文章!

您可能感興趣的文章:
  • ASP如何檢測某文件夾是否存在,不存在則自動創建

標簽:鐵嶺 溫州 昌都 麗江 昆明 泰州 咸陽 家電維修

巨人網絡通訊聲明:本文標題《asp中創建多級目錄的兩段代碼》,本文關鍵詞  asp,中,創建,多級,目錄,的,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《asp中創建多級目錄的兩段代碼》相關的同類信息!
  • 本頁收集關于asp中創建多級目錄的兩段代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 香格里拉县| 蒲城县| 安国市| 永安市| 宁城县| 株洲市| 康乐县| 永福县| 石河子市| 旺苍县| 麦盖提县| 纳雍县| 长春市| 永兴县| 邯郸县| 海口市| 米脂县| 石台县| 东安县| 明水县| 牡丹江市| 崇礼县| 齐齐哈尔市| 旬阳县| 全椒县| 墨江| 海林市| 德钦县| 当涂县| 二连浩特市| 浮山县| 班戈县| 罗田县| 盘山县| 佳木斯市| 恭城| 长阳| 清苑县| 哈密市| 吉首市| 淄博市|