I have a function that will return any files in a given folder. But in order to make it also return files in subfolders, i was told i would have to make it recursive. Recursive functions are something ive never had to use yet...and quite frankly i dont understand them. Could someone tell me what modifications i would have to make to this function to make it return subfolder files as well?
thanks,VB Code:
Function DirList(strDir As String) As String() 'returns a 0 based array with the files in strDir 'Can contain a pattern such as "*.*" Dim Count As Integer Dim sFiles() As String Dim sFile As String sFile = Dir$(strDir) Count = -1 Do Count = Count + 1 ReDim Preserve sFiles(Count) sFiles(Count) = sFile sFile = Dir$ Loop DirList = sFiles End Function
Nishant




Reply With Quote