7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
'添加 Form1、TextBox1、TextBox2、Command1
'在TextBox1中输入父目录,TextBox2中输入子目录
'半角逗号分隔
Private Sub CommandButton1_Click()
Dim arrParPath$(), arrSubPath$()
Dim strParent$, strSub$, iFileNum&, i&, j&, k&
arrParPath = Split(TextBox1.Text, ",")
arrSubPath = Split(TextBox1.Text, ",")
Me.cls
For i = 0 To UBound(arrParPath)
strParent = arrParPath(i)
If (Len(strParent) = 0) Then Exit For
For j = 0 To UBound(arrSubPath)
strSub = arrSubPath(j)
If (Len(strSub) = 0) Then Exit For
iFileNum = 0
k = Len(Dir$(strParent & "\" & strSub & "\*.*", 7))
While (k > 0)
iFileNum = iFileNum + 1
k = Len(Dir$())
Wend
Me.Print strParent & "\" & strSub; " 有文件:"; iFileNum; " 个"
Next
Next
End Sub