To read all the files with ".csv" extension in all the directories under a folder selected through FileBrowseDialog, the following code will work:
Imports System.IO.FileInfo
Imports System.IO
Dim Dir As String
Dim fni As FileInfo
lstDirList.Items.Clear()
For Each Dir In System.IO.Directory.GetDirectories(folderDlg.SelectedPath)
stDirList.Items.Add(fi)
End If
Next
Next
You should also note how to:
- Get names of all directories in a path
- Names of all files in these directories iteratively
- Information about a file
- Comparison of file extension with desired one
- How to clear data items from a list box and how to add items to listbox
0 Comments