hovercraft
Technical User
Greetings folk,
I'm stuck trying to run a vbs in the same directory that contains a folder called "reports". In the reports directory there are hundreds of sub-directories. I'm trying create a directory in each of the hundreds of sub-directories, called "archive". This is the code I'm using but it doesn't seem to do anything. The cmd window pops up but then is quickly gone. Any ideas? thanks!
I'm stuck trying to run a vbs in the same directory that contains a folder called "reports". In the reports directory there are hundreds of sub-directories. I'm trying create a directory in each of the hundreds of sub-directories, called "archive". This is the code I'm using but it doesn't seem to do anything. The cmd window pops up but then is quickly gone. Any ideas? thanks!
Code:
Dim mynewdir
Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubfolders FSO.GetFolder("reports\"), 1
Sub ShowSubFolders(Folder, Depth)
If Depth > 0 then
For Each Subfolder in Folder.SubFolders
mynewdir = Subfolder.Path & "\archive\"
set mynewdir = FSO.CreateDirectory(mynewdir)
ShowSubFolders Subfolder, Depth -1
Next
End if
End Sub