您的位置:首页 > 编程语言 > VB

VBS递归创建多级目录文件夹的方法

2019-10-21 07:04 2646 查看

核心代码

CreateFolders "d:\jb51test\1\2\3\4\5"

Function CreateFolders(path)
Set fso = CreateObject("scripting.filesystemobject")
CreateFolderEx fso,path
set fso = Nothing
End Function

Function CreateFolderEx(fso,path)
If fso.FolderExists(path) Then
Exit Function
End If
If Not fso.FolderExists(fso.GetParentFolderName(path)) Then
CreateFolderEx fso,fso.GetParentFolderName(path)
End If
fso.CreateFolder(path)
End Function

经过测试运行没问题

文中的两个函数链接CreateFolder 方法GetParentFolderName 方法

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  VBS 多级目录