by Marcos Pereira (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 16th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Recursive search with this easy code. Enter a start path and the name of a collection and this subroutine will fill that collection with all
API Declarations
'A DirBox
'A DriveBox
'Two Command Buttons
'A ListBox
'Then paste the following Code and enjoy:
'Please name me in anywhere of your credits ;-)
'//That's a simple way for automating e-mail sending:
Question = MsgBox("Do you wanna email me? (please) / ¿Quieres felicitarme?", vbYesNo + vbQuestion)
If Question = vbYes Then
Shell "EXPLORER.EXE mailto:[email protected]"
End If
Unload Me
End Sub
Public Sub FindDirs(StartPath As String, Colec As Collection)
'//This will recurse all dirs / Esto hará la búsqueda recursiva
'//from StartPath / desde StartPath
'//and return the folder names into a Collection / y depositar los nombres de las carpetas en una Colección
Set FSO = CreateObject("Scripting.FileSystemObject")
Set nFolders = FSO.GetFolder(StartPath)
Set fld = nFolders.subFolders
For Each foundedDir In fld
Colec.Add FSO.BuildPath(StartPath, foundedDir.Name)
FindDirs FSO.BuildPath(StartPath, foundedDir.Name), Colec
Next
End Sub
Private Sub Command2_Click()
'//Dim a new collection
List1.Clear
Dim NewCollection As New Collection
'//Make the search...
Me.MousePointer = 11
FindDirs Dir1.List(Dir1.ListIndex), NewCollection
Me.MousePointer = 0
'//Now iterate the collection...
For Each NewItem In NewCollection
List1.AddItem NewItem
Next
End Sub
Private Sub Drive1_Change()
Dir1.Path = Left(Drive1.Drive, 2) & ":\"
End Sub
No comments have been posted about Recursive search with this easy code. Enter a start path and the name of a collection and this subr. Why not be the first to post a comment about Recursive search with this easy code. Enter a start path and the name of a collection and this subr.