473,473 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Resursive Folders - Exclude Folders

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
Oct 12 '06 #1
3 1278
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.Ge t("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

"Gabe Matteson" <gmattesonATinqueryDOTbizwrote in message
news:On**************@TK2MSFTNGP04.phx.gbl...
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


Oct 12 '06 #2
Steve Long wrote:
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
I think it would be better to separate the values with a character that
can't appear in a folder name ;-)

Andrew
Oct 13 '06 #3
You are right Andrew. I actually didn't know you could throw a comma into a
folder name. But alas, you can, as weird as that would be but you never
know...
Steve

"Andrew Morton" <ak*@in-press.co.uk.invalidwrote in message
news:ui**************@TK2MSFTNGP02.phx.gbl...
Steve Long wrote:
>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

I think it would be better to separate the values with a character that
can't appear in a folder name ;-)

Andrew

Oct 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: could ildg | last post by:
In re, the punctuation "^" can exclude a single character, but I want to exclude a whole word now. for example I have a string "hi, how are you. hello", I want to extract all the part before the...
1
by: Rajesh Abraham | last post by:
I would like to Exclude MyApp.Exe.Config from my Setup Package as I don't want it to get overwritten during upgrade installation of my application. If I remove app.config while building the...
0
by: VB Programmer | last post by:
When I publish a 2.0 website how can I exclude certain folders & files that are unnecessary. After waiting for about 5 minutes for the publish to finish I manually stopped VS2005 because it was...
1
by: John Dalberg | last post by:
In VS 2003, I was able to exclude full folders from a project but I can't do the same in VS 2005. I can exclude files but not folders. I prefer to exclude at the folder level because the folder...
9
by: David Pratt | last post by:
Hi. I'm trying to clean files for packaging on mac using os.path.walk and want to clean the .DS_Store files that are hidden from view but could end up in code that I produce. # Clean mac...
0
by: Ajak | last post by:
Hi, I'm using Visual studio .NET 2003 to work on asp.net project. In my project folder, every folders contains a special folder '_svn' used by TortoiseSVN, a 3rd party version control tools. My...
2
by: Arsen V. | last post by:
Hi, How to exclude the App_Data directory from Visual SourceSafe? It appears that Vs 2005 automatically adds the App_Data directory with the large binary MDF and LOG files to the Visual...
1
by: AntiChrist | last post by:
In VS 2005 if you exclude files from a project, it actually renames the file to filename.exclude. In previous versions, it just left the file alone but excluded it. If you have a very large...
10
by: Simon Brooke | last post by:
I'm struggling to understand what 'exclude-result-prefixes' does and is for; the language of the standard http://www.zvon.org/xxl/XSLTreference/W3C/xslt.html#literal-result-element is not...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.