VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Recursive Function to Check Folders / Files Under the Passed Folder

by Raghuraja. C (21 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 17th February 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Recursive Function to Check Folders / Files Under the Passed Folder

API Declarations


Global arrFileSend() As String


Rate Recursive Function to Check Folders / Files Under the Passed Folder



Private Function fnGotoFolders(ByVal folToCheck As Folder)
'Go through the folders and Store files to array and process

    On Error GoTo LOCALERRORHANDLER
    
    Dim objFile         As File                     'A file of the folder
    Dim objfolder       As Folder                   'A folder in side a folder
    Dim objFSO          As New FileSystemObject
    
    If folToCheck <> "" Then
       For Each objFile In folToCheck.Files
            'Call a function to process the file which is received
            If intTotFile = 0 Then
                arrFileSend(intTotFile) = CStr(objFile)
                intTotFile = intTotFile + 1
            Else
                ReDim Preserve arrFileSend(intTotFile)
                arrFileSend(intTotFile) = CStr(objFile)
                intTotFile = intTotFile + 1
            End If
        Next
        
        For Each objfolder In folToCheck.SubFolders
            Call fnGotoFolders(objfolder)
        Next
        
        Set objFSO = Nothing
    End If
    
    Exit Function

LOCALERRORHANDLER:
End Function

Download this snippet    Add to My Saved Code

Recursive Function to Check Folders / Files Under the Passed Folder Comments

No comments have been posted about Recursive Function to Check Folders / Files Under the Passed Folder. Why not be the first to post a comment about Recursive Function to Check Folders / Files Under the Passed Folder.

Post your comment

Subject:
Message:
0/1000 characters