Hopefully "ScriptingTipsAndTricks" helps you with your batch file or vbscript scripting :-)
[Bottom][Contents][Prev]: CommaSeperatedHexString() - Dump string as hex values seperated by commas[Next]: Dictionary Objects - store and retrieve information under a key
\->VBSCRIPT Files->CreateDirectoryTree() aka CreateFolderTree - Native VBSCRIPT can not do this

[anchor]

The Code for: "CreateDirectoryTree() aka CreateFolderTree [Native VBSCRIPT can not do this].vbs.txt"

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


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: CommaSeperatedHexString() - Dump string as hex values seperated by commas[Next]: Dictionary Objects - store and retrieve information under a key


ScriptingTipsAndTricks© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday September 07 2014 at 12:50pm
Visit ScriptingTipsAndTricks's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.