vbs: Show all Folder subfolders with an iterative script?


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



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.


  • ActiveXObject(“Scripting.FileSystemObject”) not working for me
  • variable data in ghostscript commandline
  • how to extract the properties of all files and folders of a particular directory using vbscript?
  • Renaming pdf files with a batch file
  • copying files to another folder and renaming them based on the creation date using vbscript
  • How to use Excel VBA to activate and copy row data from multiple worksheets in multiple workbooks in
  • Combine many CSV files into one Excel document, keep original date format intact
  • Copy cell J1 from multiple files and paste into column of masterfile
  • Java Mail API: Accessing “All Mail” folder of GMAIL mailbox
  • VBA - select the first file from a specific folder and reply all
  • Java mail don't return subject
  • Excel Macro listing all files within the contained directory and hyperlinking them
  • Apply existing VBS folder search to sub folders?
  • Extract text between HTML tags
  • Get a VSS project tree for a specified label using the command line?
  • How to convert all *.potx files to *.pptx files with VBA?
  • Moving and Renaming Files Using VBScript
  • Create Virtual Directory IIS7 to be use in GetFolder in Server.CreateObject(“Scripting.FileSystemObj
  • Read Recent and Unseen message using javax.mail
  • Issue processing MailDir format with Java on Windows
  • How do I add a File Type Association in a Windows Phone 8.1 app manifest?
  • Double-click autofill - dynamic based on adjacent cell
  • Excel VBA URLDownloadToFile Error for https Ressource
  • Creating a Multidimensional, Associative Array in VBScript
  • Where these are stored?
  • DIV instruction jumping to random location?
  • Conversion from string “a” to type 'Boolean' is not valid
  • Django simple Captcha “No module named fields” error
  • Display images in Django
  • Problem deserializing objects from cache on MyBatis 3/Java
  • why overloaded new operator is calling constructor even I am using malloc inside overloading functio
  • C# - Serializing and deserializing static member
  • Bug in WPF DataGrid
  • JavaScriptCore crash on iOS9
  • Incrementing object id automatically JS constructor (static method and variable)
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?