VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Recursive Get ALL files from a Folder and its Subfolders and its Subfolder Subfolders etc.

by Alexander Triantafyllou (5 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 21st April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Recursive Get ALL files from a Folder and its Subfolders and its Subfolder Subfolders etc.

API Declarations


"Microsoft Scripting Runtime"
Insert a Textbox called textbox1 With its multiline Property Set To true. Also a Command Button called Command1 .


Rate Recursive Get ALL files from a Folder and its Subfolders and its Subfolder Subfolders etc.





Private Sub command1_click()
    Dim fso As New FileSystemObject
    myfoldertext="C:\folder\"
    call get_all_directory_files(fso.getfolder(myfoldertext))
    text1.text=filetext
    Set fso=nothing
End Sub


Public Sub get_all_directory_files(ByVal tfolder As folder)
    Dim objfile As file
    Dim objfolder As folder
    Dim fso As New FileSystemObject


    If tfolder <> "" Then


        For Each objfile In tfolder.Files
            'do the stuff we want with the files
            filetext=filetext+objfile+ vbNewLine
        Next


        For Each objfolder In tfolder.SubFolders
            Call get_all_directory_files(objfolder)
        Next
        Set fso = Nothing
    End If
End Sub

Download this snippet    Add to My Saved Code

Recursive Get ALL files from a Folder and its Subfolders and its Subfolder Subfolders etc. Comments

No comments have been posted about Recursive Get ALL files from a Folder and its Subfolders and its Subfolder Subfolders etc.. Why not be the first to post a comment about Recursive Get ALL files from a Folder and its Subfolders and its Subfolder Subfolders etc..

Post your comment

Subject:
Message:
0/1000 characters