✔ 最佳答案
I'm not so familiar with VB's syntax, but the idea is:
1. Print current directory files
2. Check the parsed integer
3. if the integer > 1 (need further depth), call PrintFilePath (path, integer-1)
This is to repeat the sub with its sub-directory, and with the depth -1
4. end function
I have tried my best to use VB syntax to modify your program. Please let me know if this failed to work.
Sub PrintFilePath(ByVal path As String, ByVal depth As Integer)
For Each FilePath As String In My.Computer.FileSyst em.GetFiles(Path)
System.Console.Write Line("The file path is: " & FilePath )
Next
if depth>1 then
depth=depth-1
For Each FolderPath As String In My.Computer.FileSystem.GetDirectories(Path)
PrintFilePath(FolderPath, depth)
Next
end if