Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Looking for a function to get the Subdirectories of the Subdirectory

Posted on 2006-10-27
4
Medium Priority
?
4,827 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: 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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

718 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