Sub ScanFolder(FolderSpec)
Dim thisFolder As Folder
Dim allFolders As Folders
Dim thisFile As File
Dim allFiles As Files
Dim TotalCDSize As Long
Dim i As Integer
Dim x As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set fso = New FileSystemObject
rs.Open dtaVolumes.RecordSource, dtaVolumes.ConnectionString, adOpenKeyset, adLockOptimistic
Set thisFolder = fso.GetFolder(FolderSpec)
Set allFolders = thisFolder.SubFolders
For Each thisFolder In allFolders
If (thisFolder.Attributes And Hidden) <> Hidden Then
Set allFiles = thisFolder.Files
If allFiles.Count > 0 Then
For Each thisFile In allFiles
TotalCDSize = TotalCDSize + thisFile.Size
Next
pbrProgress.Max = TotalCDSize
For Each thisFile In allFiles
rs.AddNew
rs!Files = thisFile.Name
pbrProgress.Value = pbrProgress.Value + thisFile.Size
Next
End If
Set allFiles = Nothing
ScanFolder thisFolder.Path
End If
DoEvents
Next
Set thisFolder = Nothing
Set allFolders = Nothing
Set rs = Nothing
Set fso = Nothing
Exit Sub
Unload Me
End Sub