473,549 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HLP: Finding file Types

I'm writing an app where I'm trying to look for and List all specific file
'types' found. So I point to a specific start top level Folder... and I want
to drill down through ALL sub folders to find file types (using File
Extenion).

All found DWG files are listed in "lbDwgList" Listbox.

I can get the top level and the 'immediate' level below the top level... but I
can't figure out how to keep going down X levels (ie: All sub-levels). Any
help appreciated!

Here's what I've go so far:

Imports System.IO

Public Class Form1
Inherits System.Windows. Forms.Form

Dim DWGFilPth As String ' DWG Files Path
Dim DWGfilname As String ' DWG Name
Dim DWGtestname As String ' DWG Test Name

(((#Region " Windows Form Designer generated code ")))

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
' *********
' Form Load
' *********

' *********** Start Folder Paths ***********

DWGFilPth = "P:\Project s\"
' *************** *************** ************

' Find Plot Styles in Multiple Folders and Lists them
' Get Folder Names Listing in DWGs Path
Dim rootDi As New DirectoryInfo(D WGFilPth)

' Look for DWG's in Root DWG File Path
Dim DWGdirsRt() As String = Directory.GetFi les(DWGFilPth)
For Each DWGfilname In DWGdirsRt
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Test for DWG files
Dim FilTest As String = DWGtestname.Rem ove(0, (Len(DWGtestnam e) - 3))
If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
Next

' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
Dim DWGdirs() As String = Directory.GetFi les(DWGFilPth & di.Name)
For Each DWGfilname In DWGdirs
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Test for DWG files
Dim FilTest As String = DWGtestname.Rem ove(0, (Len(DWGtestnam e) - 3))
If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
Next
Next

' *************
' End Form Load
' *************
End Sub

End Class
Regards,

Bruce
Jul 21 '05 #1
8 2036
Hi Mr B,

You need to do it using a recursive function call. Add the following
function to your form...

\\\
Private Sub GetDWGFiles(ByV al DWGFilPth As String)
' Find Plot Styles in Multiple Folders and Lists them
' Get Folder Names Listing in DWGs Path
Dim rootDi As New DirectoryInfo(D WGFilPth)

' Look for DWG's in Root DWG File Path
Dim DWGdirsRt() As String = Directory.GetFi les(DWGFilPth)
Dim DWGfilname As String
Dim DWGtestname As String
For Each DWGfilname In DWGdirsRt
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Look for DWG's in Root DWG File Path
If DWGtestname.Len gth >= 3 Then
Dim FilTest As String = DWGtestname.Rem ove(0,
(Len(DWGtestnam e) - 3))
' Test for DWG files
If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
End If
Next

' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
AddFilesToList( di.FullName)
Next
End Sub
///

....then call the function in your Form_Load event...

\\\
Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
' *********
' Form Load
' *********

GetDWGFiles("P: \Projects")

' *************
' End Form Load
' *************
End Sub
///

HTH,
Gary

"Mr. B" <Us**@NoWhere.c om> wrote in message
news:md******** *************** *********@4ax.c om...
I'm writing an app where I'm trying to look for and List all specific file
'types' found. So I point to a specific start top level Folder... and I want to drill down through ALL sub folders to find file types (using File
Extenion).

All found DWG files are listed in "lbDwgList" Listbox.

I can get the top level and the 'immediate' level below the top level... but I can't figure out how to keep going down X levels (ie: All sub-levels). Any help appreciated!

Here's what I've go so far:

Imports System.IO

Public Class Form1
Inherits System.Windows. Forms.Form

Dim DWGFilPth As String ' DWG Files Path
Dim DWGfilname As String ' DWG Name
Dim DWGtestname As String ' DWG Test Name

(((#Region " Windows Form Designer generated code ")))

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
' *********
' Form Load
' *********

' *********** Start Folder Paths ***********

DWGFilPth = "P:\Project s\"
' *************** *************** ************

' Find Plot Styles in Multiple Folders and Lists them
' Get Folder Names Listing in DWGs Path
Dim rootDi As New DirectoryInfo(D WGFilPth)

' Look for DWG's in Root DWG File Path
Dim DWGdirsRt() As String = Directory.GetFi les(DWGFilPth)
For Each DWGfilname In DWGdirsRt
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Test for DWG files
Dim FilTest As String = DWGtestname.Rem ove(0, (Len(DWGtestnam e) - 3)) If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
Next

' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
Dim DWGdirs() As String = Directory.GetFi les(DWGFilPth & di.Name)
For Each DWGfilname In DWGdirs
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Test for DWG files
Dim FilTest As String = DWGtestname.Rem ove(0, (Len(DWGtestnam e) - 3)) If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
Next
Next

' *************
' End Form Load
' *************
End Sub

End Class
Regards,

Bruce

Jul 21 '05 #2
With Deft Fingers, "Gary Milton" <an*******@disc ussions.microso ft.com> wrote:
You need to do it using a recursive function call. Add the following
function to your form... ' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
AddFilesToList( di.FullName)
Next
End Sub HTH,
Gary


Hmmmmm....

Looks like I need to work on this... Your example only displays the folders
under the Root folder :(

Oh well.. thanks for the reply... I might be able to work something out.

Regards,

Bruce
Jul 21 '05 #3
Hi Mr B,

You need to do it using a recursive function call. Add the following
function to your form...

\\\
Private Sub GetDWGFiles(ByV al DWGFilPth As String)
' Find Plot Styles in Multiple Folders and Lists them
' Get Folder Names Listing in DWGs Path
Dim rootDi As New DirectoryInfo(D WGFilPth)

' Look for DWG's in Root DWG File Path
Dim DWGdirsRt() As String = Directory.GetFi les(DWGFilPth)
Dim DWGfilname As String
Dim DWGtestname As String
For Each DWGfilname In DWGdirsRt
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Look for DWG's in Root DWG File Path
If DWGtestname.Len gth >= 3 Then
Dim FilTest As String = DWGtestname.Rem ove(0,
(Len(DWGtestnam e) - 3))
' Test for DWG files
If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
End If
Next

' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
AddFilesToList( di.FullName)
Next
End Sub
///

....then call the function in your Form_Load event...

\\\
Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
' *********
' Form Load
' *********

GetDWGFiles("P: \Projects")

' *************
' End Form Load
' *************
End Sub
///

HTH,
Gary

"Mr. B" <Us**@NoWhere.c om> wrote in message
news:md******** *************** *********@4ax.c om...
I'm writing an app where I'm trying to look for and List all specific file
'types' found. So I point to a specific start top level Folder... and I want to drill down through ALL sub folders to find file types (using File
Extenion).

All found DWG files are listed in "lbDwgList" Listbox.

I can get the top level and the 'immediate' level below the top level... but I can't figure out how to keep going down X levels (ie: All sub-levels). Any help appreciated!

Here's what I've go so far:

Imports System.IO

Public Class Form1
Inherits System.Windows. Forms.Form

Dim DWGFilPth As String ' DWG Files Path
Dim DWGfilname As String ' DWG Name
Dim DWGtestname As String ' DWG Test Name

(((#Region " Windows Form Designer generated code ")))

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
' *********
' Form Load
' *********

' *********** Start Folder Paths ***********

DWGFilPth = "P:\Project s\"
' *************** *************** ************

' Find Plot Styles in Multiple Folders and Lists them
' Get Folder Names Listing in DWGs Path
Dim rootDi As New DirectoryInfo(D WGFilPth)

' Look for DWG's in Root DWG File Path
Dim DWGdirsRt() As String = Directory.GetFi les(DWGFilPth)
For Each DWGfilname In DWGdirsRt
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Test for DWG files
Dim FilTest As String = DWGtestname.Rem ove(0, (Len(DWGtestnam e) - 3)) If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
Next

' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
Dim DWGdirs() As String = Directory.GetFi les(DWGFilPth & di.Name)
For Each DWGfilname In DWGdirs
DWGtestname = System.IO.Path. GetFileName(DWG filname)
' Test for DWG files
Dim FilTest As String = DWGtestname.Rem ove(0, (Len(DWGtestnam e) - 3)) If UCase(FilTest) = "DWG" Then
lbDwgList.Items .Add(DWGtestnam e)
End If
Next
Next

' *************
' End Form Load
' *************
End Sub

End Class
Regards,

Bruce

Jul 21 '05 #4
With Deft Fingers, "Gary Milton" <an*******@disc ussions.microso ft.com> wrote:
You need to do it using a recursive function call. Add the following
function to your form... ' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
AddFilesToList( di.FullName)
Next
End Sub HTH,
Gary


Hmmmmm....

Looks like I need to work on this... Your example only displays the folders
under the Root folder :(

Oh well.. thanks for the reply... I might be able to work something out.

Regards,

Bruce
Jul 21 '05 #5
That was a typo - the recursion call should be...

\\\
' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
GetDWGFiles(di. FullName)
Next
///

Gary

"Mr. B" <Us**@NoWhere.c om> wrote in message
news:vi******** *************** *********@4ax.c om...
With Deft Fingers, "Gary Milton" <an*******@disc ussions.microso ft.com> wrote:
You need to do it using a recursive function call. Add the following
function to your form...
' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
AddFilesToList( di.FullName)
Next
End Sub

HTH,
Gary


Hmmmmm....

Looks like I need to work on this... Your example only displays the

folders under the Root folder :(

Oh well.. thanks for the reply... I might be able to work something out.

Regards,

Bruce

Jul 21 '05 #6
That was a typo - the recursion call should be...

\\\
' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
GetDWGFiles(di. FullName)
Next
///

Gary

"Mr. B" <Us**@NoWhere.c om> wrote in message
news:vi******** *************** *********@4ax.c om...
With Deft Fingers, "Gary Milton" <an*******@disc ussions.microso ft.com> wrote:
You need to do it using a recursive function call. Add the following
function to your form...
' Look for DWG's in Sub-Folders of DWG File Root Folder
Dim di As DirectoryInfo
For Each di In rootDi.GetDirec tories
AddFilesToList( di.FullName)
Next
End Sub

HTH,
Gary


Hmmmmm....

Looks like I need to work on this... Your example only displays the

folders under the Root folder :(

Oh well.. thanks for the reply... I might be able to work something out.

Regards,

Bruce

Jul 21 '05 #7
With Deft Fingers, "Gary Milton" <an*******@disc ussions.microso ft.com> wrote:
That was a typo - the recursion call should be...


Aha! Excellent. Thanks Muchly.... nice to know how it's done!

Great stuff!

Regards,

Bruce
Jul 21 '05 #8
With Deft Fingers, "Gary Milton" <an*******@disc ussions.microso ft.com> wrote:
That was a typo - the recursion call should be...


Aha! Excellent. Thanks Muchly.... nice to know how it's done!

Great stuff!

Regards,

Bruce
Jul 21 '05 #9

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

Similar topics

0
1079
by: Thiago Guedes | last post by:
Hi, how can I open a .hlp file by a link in a asp.net page? *** <asp:hyperlink id="HyperLink1" runat="server" NavigateUrl="help/help.HLP">Help</asp:hyperlink> **** When the link open I dont want choose a "OPEN" or "SAVE" options... i want just open this..
0
251
by: Mr. B | last post by:
I'm writing an app where I'm trying to look for and List all specific file 'types' found. So I point to a specific start top level Folder... and I want to drill down through ALL sub folders to find file types (using File Extenion). All found DWG files are listed in "lbDwgList" Listbox. I can get the top level and the 'immediate' level...
0
1604
by: MLH | last post by:
I have the following code partially built from stuff I cut 'n pasted from A97 help... 120 Dim Msg, Style, Title, Help, Ctxt, Response, MyString 140 Msg = "You started to enter something. Are you sure you want to quit without saving?" ' Define message. 160 Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define...
2
1419
by: I D via .NET 247 | last post by:
Hello, I am CSharp developer working on a bigger proeject. WHat is the best way to integrate help in a CSharp application. (I mean F1 sensitive help) I already created with Help&Manual a .hlp file and I am looking for ways to link it to my application and to my forms.Can anyone help? -------------------------------- From: I D
1
6012
by: xzzy | last post by:
How is a .HLP help file displayed from a C# winforms application? Thank you, John Bickmore
2
1523
by: Thiago Guedes | last post by:
Hi, how can I open a .hlp file by a link in a asp.net page? *** <asp:hyperlink id="HyperLink1" runat="server" NavigateUrl="help/help.HLP">Help</asp:hyperlink> **** When the link open I dont want choose a "OPEN" or "SAVE" options... i want just open this..
0
1307
by: Madmax | last post by:
I am trying to use the .hlp file (an old help from for an existing app) in my application .Although the file shows up but it does not open the desired search string this is what I am doing string strHelp = C:\myfolder\ABC.HLP"; //its a hlp file Help.ShowHelp(this, strHelp,"Glossary");
2
1596
by: vijesh purbia | last post by:
I am not able to run a help file(.hlp format) in vb.net 2005 .So please help me regarding the issue. OS-XP-PROFESSIONAL PLATFORM-VB.NET 2005 thanks & regards vijesh purbia
2
1760
by: HornyAZNBoy | last post by:
I've just wrote a hlp file to a program I just completed. Now I want to open that hlp file with a command on my program. I've tried using the Call Shell(C:/WINDOWS/Cris/desktop/MS Skill Book/Skill Book.exe) method and it works fine, but now I want to send it to a friend and I want him to be able to open that hlp file, but his computer name isn't...
2
1378
jkmyoung
by: jkmyoung | last post by:
Does anyone know of good software to create a windows help file? .hlp There seems to be tons out there, but the ones lately I've tried so far aren't that great. Looking for both free and commercial tools for this task. (We tried creating a wiki, but that got shut down by management...:( )
0
7464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7734
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7979
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7826
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6065
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5385
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1960
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 we have to send another system

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.