65198

Question:
IS it possible to get all Subfolders (And the subfolders from the subfolders,...) of an Directory with an iterative script?
I already created it recursive but im not possible to do it iterative :/
Anyone an idea :O
thanks...
Answer1:You'll have to implement the stack which a recursive Sub/Function gives you for free:
Dim sSDir : sSDir = "..."
walkDirIter goFS.GetFolder(sSDir)
Sub walkDirIter(oDir)
Dim dicStack : Set dicStack = CreateObject("Scripting.Dictionary")
Dim nCur : nCur = dicStack.Count
Set dicStack(nCur) = oDir
Do Until nCur >= dicStack.Count
Dim oElm
For Each oElm In dicStack(nCur).Files
WScript.Echo oElm.Path
Next
For Each oElm In dicStack(nCur).SubFolders
Set dicStack(dicStack.Count) = oElm
Next
nCur = nCur + 1
Loop
End Sub ' walkDirIter
You could look at <a href="https://stackoverflow.com/a/10210862/603855" rel="nofollow">this recursive approach</a> for context/comparison.