Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Looking for a function to get the Subdirectories of the Subdirectory

Posted on 2006-10-27
4
Medium Priority
?
4,831 Views
Last Modified: 2010-06-04
Hello

I am looking for a function to get the Subdirectories of the Subdirectory in Visual Basic .Net.

I am currently using IO.Directory.GetDirectories("c:\mypath\"), but this gives me only sub folder of c:\mypath e.g.

c:\mypaths\t1
c:\mypaths\t2
c:\mypaths\t3

but not the subfolders of e.g c:\mypaths\t1 e.g c:\mypaths\t1\subsubfolder1, c:\mypaths\t1\subsubfolder2, c:\mypaths\t1\subsubfolder3

Is there an easy function to access the whole folder tree?

Thank you for you help!

Regards

Max
0
Comment
Question by:zettler92656
4 Comments
 
LVL 10

Expert Comment

by:gangwisch
ID: 17818689
try looking at the curdir() function or there is also an application.CommonAppDataPath command
0
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 1000 total points
ID: 17818856
Sounds like you need a recursive solution....something like this:

            Public Sub ListSubDirectories(ByVal FullPath As String)
                  Dim currDirectory As New IO.DirectoryInfo(FullPath)

                  MsgBox(currDirectory.FullName)

                  For Each subDirectory As IO.DirectoryInfo In currDirectory.GetDirectories
                        ListSubDirectories(subDirectory.FullName)
                  Next
            End Sub

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question