alv
alv

Reputation: 47

looping inside folders and subfolders .net

    Dim txtbx As String = "E:\_net_programs\test"
    For Each d As String In Directory.GetDirectories(txtbx)
        'For Each di As file
        'Next
        'MessageBox.Show(d)
        'Dim folder As DirectoryInfo in directory
    Next

Please help me loop inside this folder "E:_net_programs\test" and open every sub folder

Upvotes: 1

Views: 1131

Answers (1)

Drarig29
Drarig29

Reputation: 2245

There's the code :

Dim txtbx As String = "E:\_net_programs\test"

For Each File In Directory.GetFiles(txtbx, "*", SearchOption.AllDirectories)
    MsgBox(File)
Next

If you don't want a loop of String but of FileInfo to be able to get their attributes (name, parent directory, extension, etc.), there's the code :

Dim txtbx As String = "E:\_net_programs\test"

For Each File As FileInfo In New DirectoryInfo(txtbx).GetFiles("*", SearchOption.AllDirectories)
    MsgBox(File.FullName)
Next

Upvotes: 1

Related Questions