'***函数名 : CheckFolderDir
'***函数说明: 检查某一路径中所有目录是否存在,不存在则创建
'***参数 : sFolderPath: 需检查找目录相对路径
'***返回值 : 成功则返回True,否则返回False
Function CheckFolderDir(sFolderPath)
Dim i, iCount
Dim sArrFolder
Dim sDirPath
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
sFolderPath = Replace(sFolderPath, "\", "/")
sArrFolder = Split(sFolderPath, "/")
iCount = UBound(sArrFolder)
sDirPath = Server.MapPath("/")
For i = 1 To iCount-1
If sArrFolder(i) <> "" Then
sDirPath = sDirPath & "/" & sArrFolder(i)
'判断目录是否存在,不存在则创建
If Not objFSO.FolderExists(sDirPath) Then
objFSO.CreateFolder(sDirPath)
End If
End If
Next
Set objFSO = Nothing
If Err Then
Err.Clear()
CheckFolderDir = False
Else
CheckFolderDir = True
End If
End Function