473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Drilling down through directories

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
4 1358
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kivak | last post by:
Hey everyone, I know we have to be able to do this, or Microsoft was stupid. How do we get down to the very variables in the DataGrid and FormView? Lets say I have a table to hold a product ID...
1
Lokean
by: Lokean | last post by:
Hi folks, Here's what I have so far... Dim fso, fol, subfol, fo, fls, fl, subfol2, subfol3 sSearchString = "C:\" Set fso = CreateObject("Scripting.FileSystemObject") Set fol =...
3
by: mathie | last post by:
I have an ASP.NET page that uses CrystalReportViewer. The crystal report runs fine. However a report (that runs/drills down perfectly in Crystal Report XI environment) will not drill down as if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...
0
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...

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.