|
#1
|
|||
|
|||
|
folder, subfolders, and text files
Hi everyone
,I copied one folder which contain some subfolders and after few layers of subfolders there are some text files that i want to parse. for example: my main folder is: My_Main_folder then inside it there are My_sub_one, my_sub_some, ..... then again inside these subs could be more subs until some where there are some txt file at each sub is there any easy approch to open My_Main_folder and all subs and just read txt files. Appreciate your help |
|
#2
|
|||
|
|||
|
pantea,
Here is a sub that accepts a folder name and then displays any text files in that folder and in any subfolders of that folder: Private Sub DisplayFiles(ByVal folder As String) Dim di As New DirectoryInfo(folder) Dim fi As FileInfo For Each fi In di.GetFiles If fi.Extension = ".txt" Then MsgBox("File: " & fi.FullName) End If Next Dim subDI As DirectoryInfo For Each subDI In di.GetDirectories DisplayFiles(di.FullName & "\" & subDI.Name) Next End Sub Call the sub like this: DisplayFiles("E:\Test Folder") MsgBox("Done") Kerry Moorman |
|
#3
|
|||
|
|||
|
thank you it worked perfect
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|