Solved

Looking for a function to get the Subdirectories of the Subdirectory

Posted on 2006-10-27
4
4,816 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 250 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now