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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-04-02 我要评论

核心代码

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 方法

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们