|
热门文章 |
|
|
|
|
ASP创建多级文件夹函数 |
来源:96看吧 更新时间:2010/9/13 7:47:52 阅读次数:
字体:[大 中 小大 中 小大 中 小] 我要投稿 |
'======================================================================= 'AutoCreateFolder(strPath) 自动创建指定的多级文件夹 '======================================================================= '自动创建指定的多级文件夹 'strPath为绝对路径 '调用方法: 'MyPath = "C:\a\b\c\" 'If AutoCreateFolder(MyPath) Then ' Response.Write "创建文件夹成功" 'Else ' Response.Write "创建文件夹失败" 'End If Function AutoCreateFolder(strPath) ' As Boolean On Error Resume Next Dim astrPath, ulngPath, i, strTmpPath Dim objFSO If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then AutoCreateFolder = False Exit Function End If Set objFSO = Server.CreateObject("scripting.FileSystemObject") If objFSO.FolderExists(strPath) Then AutoCreateFolder = True Exit Function End If astrPath = Split(strPath, "\") ulngPath = UBound(astrPath) strTmpPath = "" For i = 0 To ulngPath strTmpPath = strTmpPath & astrPath(i) & "\" If Not objFSO.FolderExists(strTmpPath) Then ' 创建 objFSO.CreateFolder(strTmpPath) End If Next Set objFSO = Nothing If Err = 0 Then AutoCreateFolder = True Else AutoCreateFolder = False End If End Function |
上一篇文章: ASP通过隐藏下载地址来防文件盗链下载的函数下一篇文章: ASP时间格式转化函数 |
|
|