Solved

Looking for a function to get the Subdirectories of the Subdirectory

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

810 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