Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Get  Folders  recursive  

 Content of Get Folders recursive.vbs
MD5 Hash: D47BA7AB29AF12822889CDBCD394229D

Call GetFolders("C:\Windows", True)

' ----------------------------------
Function GetFolders(sPath, bRecursive)

On Error Resume Next

Dim bCreateObject : bCreateObject = False

If not IsObject(osfo) then
Dim ofso : Set ofso = CreateObject("Scripting.FileSystemObject")
bCreateObject = True
End if

If ofso.FolderExists(sPath) = False then
If bCreateObject and IsObject(osfo) then Set osfo = Nothing
Exit Function
End if


Dim oSearchPath : Set oSearchPath = ofso.Getfolder(sPath)

If bRecursive then
For Each oFolder in oSearchPath.Subfolders
Call GetFolders(oFolder, bRecursive)
' Do something with the folders here
WScript.Echo oFolder.Path
Next
Else
For Each oFolder in oSearchPath.Subfolders
' Do something with the folders here
WScript.Echo oFolder.Path
Next
End if

If IsObject(oSearchPath) then Set oSearchPath = Nothing
If bCreateObject and IsObject(osfo) then Set osfo = Nothing

End Function

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a