Public Sub SearchSuffix(ByVal Path As String, ByVal Suffix As String)
On Error Resume Next
Dim PathChild() As String
Dim SPath As String
Dim Temp As Long
Dim Number As Long
Dim CurrentPath As String
If Right(Path, 1) <> "\" Then
Path = Path & "\"
End If
SPath = Dir(Path, vbNormal Or vbReadOnly Or vbHidden Or vbSystem Or vbDirectory Or vbVolume)
Do While SPath <> ""
CurrentPath = Path & SPath
Form1.StaPath.Panels(1).Text = CurrentPath
DoEvents
If SPath <> "." And SPath <> ".." Then
' 使用位比较来确定 SPath 代表一目录。
If (GetAttr(Path & SPath) And vbDirectory) = vbDirectory Then
Temp = Temp + 1
ReDim Preserve PathChild(Temp)
PathChild(Temp) = SPath
Else
If UCase(Right(SPath, Len(Suffix))) = UCase(Suffix) Then
Form1.List1.AddItem Path & SPath
End If
End If
End If
SPath = Dir
Loop
For Number = LBound(PathChild) To UBound(PathChild)
If PathChild(Number) <> "" Then
SearchSuffix Path & PathChild(Number), Suffix
End If
Next Number
End Sub
临摹微笑
神不在的星期二
大话西游666