核心代码
CreateFolders "d:\jb51test\1\2\3\4\5" Function CreateFolders(path)Set fso = CreateObject("scripting.filesystemobject")CreateFolderEx fso,pathset fso = NothingEnd FunctionFunction CreateFolderEx(fso,path)If fso.FolderExists(path) Then Exit FunctionEnd IfIf Not fso.FolderExists(fso.GetParentFolderName(path)) ThenCreateFolderEx fso,fso.GetParentFolderName(path)End Iffso.CreateFolder(path)End Function
经过测试运行没问题
文中的两个函数链接CreateFolder 方法与GetParentFolderName 方法。
本文标题: VBS递归创建多级目录文件夹的方法
以上就上有关VBS递归创建多级目录文件夹的方法的全部内容,学步园全面介绍编程技术、操作系统、数据库、web前端技术等内容。