VB icon

Recursive Directory Listing

Email
Submitted on: 1/5/2015 5:46:00 PM
By: Subodh Dash (from psc cd)  
Level: Intermediate
User Rating: By 2 Users
Compatibility: ASP (Active Server Pages), VbScript (browser/client side)
Views: 884
 
     This will list all the sub directories under a directory in a recursive manner. You may wish to remove the "msgbox" from the code and do something useful.
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
' for :Recursive Directory Listing
'**************************************
Free to use /Free to distribute
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Recursive Directory Listing
' Description:This will list all the sub directories under a directory in a recursive manner. You may wish to remove the "msgbox" from the code and do something useful.
' By: Subodh Dash (from psc cd)
'
' Inputs:A directory name
'
' Returns:Nothing
'
' Assumes:As the process looks through all sub directories, it is a time consuming process. For testing purpose, use a directory which has few sub directories inside it.
'**************************************

Option Explicit
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
dim rd
rd = RecursiveDir ("c:\sheridan")
function RecursiveDir (path)
	dim folderpath, fol, FolderName
	Set folderpath = fso.getfolder(path)
	Set fol = folderpath.SubFolders
	For Each Foldername In fol
		msgbox Foldername
		RecursiveDir = FolderName
		RecursiveDir FolderName
	Next
end function


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.