Advertisement
ASP_Volume2 Files/ File Controls/ Input/ Output #30333

Recurse Subdirectories

Does anything you want to files in a directory and its subdirectories. For example, if you would like to add MP3's in a directory to a playlist in your MP3 player program, this would be handy for adding all of the files including those residing in subdirectories of that directory.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'Create a DirListBox named "Dir1" and a FileListBox named "File1" and set their Visible properties to False
'Call:
'  DoDirs "C:\MyDir", "*.mp3"
Public Sub DoDirs(DirPath As String, DirFilters As String)
  File1.Pattern = DirFilters
  Dir1.Path = DirPath
  DoFiles DirPath
  If Dir1.ListCount = 0 Then Exit Sub
  For k = 0 To Dir1.ListCount - 1
    Dir1.Path = DirPath
    DoDirs Dir1.List(k), DirFilters
    'DoEvents
  Next k
  Dir1.Path = DirPath
End Sub
Private Sub DoFiles(DirPath As String)
  File1.Path = DirPath
  If File1.ListCount = 0 Then Exit Sub
  For k = 0 To File1.ListCount - 1
    FileName = File1.Path & String(1 - Abs(CInt(Right(File1.Path, 1) = "\")), "\") & File1.List(k)
    'Place what you would like to do to the files here
    
  Next k
End Sub
Original Comments (3)
Recovered from Wayback Machine