Recursive File Search or List in .NET
Post # 153 permalink Topic #153 by mreschke on 2009-09-10 09:40:04 (viewed 285 times)

I am sure you all have your functions for a recursive directory/file listing, or file searching by wildcard \
function for .net, but here is another one, works great. I use it to get a list of all *.aspx pages in \
a project like this.

Code Snippet
                Dim baseDirectory As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(“c:\projects\SSO\”)
                Dim x As New DSF.SSO.Other.FileSearch(baseDirectory, "*.aspx")
                Dim pageName As String = ""
                x.Search(, "*.aspx")
                lblMessage.Text = ""
                For Each f As System.IO.FileInfo In x.Files
                    pageName = f.FullName.Substring(baseDirectory.ToString.Length - 1, (f.FullName.Length - baseDirectory.ToString.Length) + 1)
                    pageName = pageName.Replace("\", "/")
                    DSF.SSO.Page.DAL.InsertPage(Val(txtPageGenAppID.Text), pageName.ToLower, pageName.Substring(100, pageName.Length - 4), pageName, 1, 1, 1)
                    lblMessage.Text += pageName + Chr(13)
                Next

The recusion class here
http://www.vbforums.com/showthread.php?t=341919

Or here:

Script Snippet