By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,184 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,184 IT Pros & Developers. It's quick & easy.

Drilling down through directories

P: n/a
I need to drill down from a directory through all the sub directories
and build up a list of files. I have VB6 code to do this but it uses
APIs etc and am hoping that there is a better way of doing in .net 2003

I would appreciate any help or examples that anyone can give me

Thanks

Jack Russell
Mar 27 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Jack Russell wrote:
I need to drill down from a directory through all the sub directories
and build up a list of files. I have VB6 code to do this but it uses
APIs etc and am hoping that there is a better way of doing in .net 2003

I would appreciate any help or examples that anyone can give me

Thanks

Jack Russell
Its ok I found getdirectories!
Mar 27 '07 #2

P: n/a
"Jack Russell" <ja***@norubbish.tpg.com.auwrote in message
news:ec*************@TK2MSFTNGP05.phx.gbl...
Jack Russell wrote:
>I need to drill down from a directory through all the sub directories and
build up a list of files. I have VB6 code to do this but it uses APIs etc
and am hoping that there is a better way of doing in .net 2003

I would appreciate any help or examples that anyone can give me

Thanks

Jack Russell
Its ok I found getdirectories!
I did this as an enumerator, so I could just do:

for each file in new DirEnumerator("C:\")

I can't remember the exact details but I could dig it up if you are
interested.

Michael
Mar 27 '07 #3

P: n/a
Michael C wrote:
"Jack Russell" <ja***@norubbish.tpg.com.auwrote in message
news:ec*************@TK2MSFTNGP05.phx.gbl...
>>Jack Russell wrote:
>>>I need to drill down from a directory through all the sub directories and
build up a list of files. I have VB6 code to do this but it uses APIs etc
and am hoping that there is a better way of doing in .net 2003

I would appreciate any help or examples that anyone can give me

Thanks

Jack Russell

Its ok I found getdirectories!


I did this as an enumerator, so I could just do:

for each file in new DirEnumerator("C:\")

I can't remember the exact details but I could dig it up if you are
interested.

Michael

Thanks but I have nearly finished

Jack
Mar 27 '07 #4

P: n/a
Jack,

Here is some code that you might be able to modify for your needs:

'Be sure to have an Imports System.IO statement in the class that contains
this code

Private Sub DisplayFolderInfo(ByVal folder As String)

Dim di As New DirectoryInfo(folder)
Dim fi As FileInfo

MsgBox("Folder: " & folder)

For Each fi In di.GetFiles
MsgBox("File: " & fi.FullName)
Next

Dim subDI As DirectoryInfo
For Each subDI In di.GetDirectories
DisplayFolderInfo(di.FullName & "\" & subDI.Name)
Next

End Sub

To get the process started:

DisplayFolderInfo("c:\Test")

Kerry Moorman
"Jack Russell" wrote:
I need to drill down from a directory through all the sub directories
and build up a list of files. I have VB6 code to do this but it uses
APIs etc and am hoping that there is a better way of doing in .net 2003

I would appreciate any help or examples that anyone can give me

Thanks

Jack Russell
Mar 28 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.