/bundles/itninjaweb/img/Breadcrumb_cap_w.png
I want to check if C:\Test\Log exits if not create C:\Test\Log.
I used the script to create a folder which creates only till C:\Test.
Not really sure how to create the complete path.
Please help...its highly important..Thanks
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0

Sub CreateRecursiveDirectory(LocalPath)
On Error Resume Next
if Not oFSO.FolderExists(LocalPath) Then
if Not oFSO.FolderExists(oFSO.GetParentFolderName(LocalPath)) Then
CreateRecursiveDirectory(oFSO.GetParentFolderName(LocalPath))
End if
oFSO.CreateFolder(LocalPath)
Else
oFSO.GetFolder(LocalPath)
End If
On Error Goto 0
End Sub


Example of using:


CreateRecursiveDirectory "C:\bd\data\notes"
Answered 06/17/2011 by: itolutions
Purple Belt

Please log in to comment
0
Nice script! [;)]

Just so the OP isn't scratching his head forever and a day, you'll have to create the FileSystemObject first at the top.....
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Answered 06/18/2011 by: captain_planet
Fourth Degree Brown Belt

Please log in to comment
0
Thanks a lot
Answered 06/19/2011 by: VATMAN
Orange Belt

Please log in to comment