Advertisement
7_2009-2012 Files #218352

ASP Procedure Used To Recurse Through All SubFolders Of Any Given Path

Use it to recurse (walk-through) every sub-directory of any given path. Use it to find a file or list all files in any given path.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<%
	Sub Recurse(Path)
		
		Dim fso, Root, WindowsFolder, Files, _
			Folders, File, i, FoldersArray(100)
			
		Set fso = Server.CreateObject("Scripting.FileSystemObject")
		Set Root = fso.getfolder(Path)
		Set Files = Root.Files
		Set Folders = Root.SubFolders
		For Each File In Files
			'''''''''''''''''''''''''''''
			'Code For Each File Found
			'Goes Here!
			'''''''''''''''''''''''''''''
		Next
			
		For Each Folder In Folders
			'''''''''''''''''''''''''''''
			'Code For Each Folder Found
			'Goes Here!
			'''''''''''''''''''''''''''''
			FoldersArray(i) = Folder.Path
			i = i + 1
		Next
			 	
		For i = 0 To UBound(FoldersArray)
			If FoldersArray(i) <> "" Then 
				Recurse FoldersArray(i)				
			Else
				Exit For
			End If
		Next
		
	End Sub
%>
Original Comments (3)
Recovered from Wayback Machine