Public Class Form1 Dim SubDir As New Stack(Of String) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FileOpen(1, "C:/clipart/index.txt", OpenMode.Output) Dim Path As String = "C:/clipart/" Showfiles("C:/clipart/") While SubDir.Count > 0 Path = SubDir.Pop Showfiles(Path) End While FileClose(1) End Sub Private Sub Showfiles(ByVal Path As String) Dim Filename, PathFile As String Filename = Dir(Path, FileAttribute.Directory) While Filename <> "" PathFile = Path & "/" & Filename & "/" If (GetAttr(PathFile) And vbDirectory) = vbDirectory Then SubDir.Push(PathFile) Else PrintLine(1, Filename) End If Filename = Dir() End While End Sub End Class