all groups > vb.net controls > october 2006 >
You're in the

vb.net controls

group:

Resursive Folders - Exclude Folders


Re: Resursive Folders - Exclude Folders Steve Long
10/12/2006 3:04:09 PM
vb.net controls:
Hmmm, one thing you could do, if you know before hand what folders you want
to exclude, is to include the list of folders that you don't want to be
queried in your app.config file. The values could be comma seperated and
then just get the values with:
Dim arr() as string =
Configuration.ConfigurationSettings.AppSettings.Get("keyname").Split(",")
Stuff these values into a dictionary and then if the folder doesn't exist in
the dictionary, go ahead and query it.

Someone else may have a better idea but this would work. I use this
methodology for other types of things so there's no reason it wouldn't work.

Steve

[quoted text, click to view]

Resursive Folders - Exclude Folders Gabe Matteson
10/12/2006 4:22:39 PM
How would I go about excluding a list of specific directories in a listbox
from being queried using the following code? Any ideas? Thank you.

Private Sub rAllStats(ByVal sDir As String)

Try

Dim objFolder As New System.IO.DirectoryInfo(sDir)

Dim objFile As System.IO.FileInfo() = objFolder.GetFiles

Dim sFile As System.IO.FileInfo



For Each objFolder In objFolder.GetDirectories

intTDirCount += 1

rAllStats(objFolder.FullName)

Next

'process files

For Each sFile In objFile

intTFileCount += 1

Next

end try

AddThis Social Bookmark Button