473,761 Members | 10,498 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 2058
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
1086
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 below the top level... but I can't figure out how to keep going down X levels (ie: All sub-levels). ...
0
1617
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 buttons. 180 Title = "Continue? - " & MyApp$ & ", rev. " & MY_VERSION$ ' Define title.
2
1430
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
6017
by: xzzy | last post by:
How is a .HLP help file displayed from a C# winforms application? Thank you, John Bickmore
2
1530
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
1314
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
1610
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
1770
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 Cris. Any suggestions? I've also tried this method and it is not working. Command1_Click()...
2
1396
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
9333
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5214
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.