Solved

Looking for a function to get the Subdirectories of the Subdirectory

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

16 Experts available now in Live!

Get 1:1 Help Now