This is the example, a shortcut was installed to this code
:
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' $Header: C:/DBAREIS/Projects.PVCS/Win32/ScriptingTipsAndTricks/EXAMPLE[vbs].CreateDirectoryTree() aka CreateFolderTree [Native VBSCRIPT can not do this].vbs.txt.pvcs 1.0 29 Jun 2014 12:51:22 USER "D$
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
...
UserFileDir = "c:\A.NoSuch\b\c\d\e\f\g"
CreateDirectoryTree oFS, UserFileDir
...
'============================================================================
function CreateDirectoryTree(ByRef oFS, byVal UserDirName) 'Version 14.152a
'
' Overcomes the FSO restriction (it can not create a whole tree)
'
' Also note the FSO does not handle UNC names very well...
' I will probably improve code to work around the "features".
'=====================================================================
'--- Make sure we don't have problems ------------------------------------
CreateDirectoryTree = false
if UserDirName = "" then exit function
on error resume next
'--- Make sure the parent exists -----------------------------------------
dim ParentDir : ParentDir = oFS.GetParentFolderName(UserDirName)
if not oFS.FolderExists(ParentDir) then
CreateDirectoryTree oFS, ParentDir
end if
'--- Now create this directory -------------------------------------------
if oFS.FolderExists(UserDirName) then
CreateDirectoryTree = true
else
'--- Create directory ------------------------------------------------
err.clear()
oFS.CreateFolder UserDirName
if err.number = 0 then
CreateDirectoryTree = true
end if
end if
end function