时间:2016-02-24 17:36 来源: 我爱IT技术网 作者:佚名
欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【使用FSO自动创建多级文件夹的函数】,下面是详细的分享!
使用FSO自动创建多级文件夹的函数
’ --------------------------------
’ 自动创建指定的多级文件夹
’ strPath为绝对路径
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
以上所分享的是关于使用FSO自动创建多级文件夹的函数,下面是编辑为你推荐的有价值的用户互动:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
