Search Tools Links Login

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.

Original Author: ObjectMethod

Inputs

"PATH" = Starting location of search

Returns

You can write your own code for each file or folder found.

Code

<%
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
%>

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 117 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.