How to build a new file system path

Author Message
robwm

  • Total Posts : 118
  • Scores: 0
  • Reward points : 0
  • Joined: 3/10/2009
  • Location: Seattle, WA
  • Status: offline
How to build a new file system path Wednesday, December 07, 2011 11:51 AM (permalink)
0
Hi,
 
I would like to know how to build a specific folder path with vbscript. Is there a method available that can build a multi-level path all at once or do you have to build one level at a time? I am thinking of the way mkdir works in DOS. You can use mkdir with the complete path you want and it will make it in one shot.
 
I would like to make a path - C:\level1\level2\level3
 
Is this the only way to do it or can you use one method to do it all at once?
 
Dim objFolder, objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:\level1")
Set objFolder = objFSO.CreateFolder("C:\level1\level2")
Set objFolder = objFSO.CreateFolder("C:\level1\level2\level3")
 
Thanks,
Rob
 
#1
    ehvbs

    • Total Posts : 3320
    • Scores: 112
    • Reward points : 0
    • Joined: 6/22/2005
    • Location: Germany
    • Status: offline
    Re:How to build a new file system path Wednesday, December 07, 2011 12:39 PM (permalink)
    0
    Either use ebgreen's smart recursive method:
    http://www.visualbasicscript.com/fb.ashx?m=29290
    or shell out to mkdir.
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9