- ©«¤l
- 228
- ¥DÃD
- 73
- ºëµØ
- 2
- ¿n¤À
- 333
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 10
- ³nÅ骩¥»
- Office 2000, 2019
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¹ü¤Æ¿¤
- µù¥U®É¶¡
- 2013-7-18
- ³Ì«áµn¿ý
- 2024-10-13
|
±N¥H¤U¥N½X¦s¦¨¼Ò²Õ¡A¥Îªk½Ð¦Û¦æ´ú¸Õ¡I§Ú¤£ª¾¹D¾A¤£¾A¦X¡I
Option Explicit
Option Base 1
Public Àɮ׸ê°T°}¦C() As String
Public Sub ·j´MÀÉ®×(ByVal ¸ê®Æ§¨¸ô®| As String, ByVal ¿z¿ïÀɦW As String, ByVal ¥]§t¤l¸ê®Æ§¨ As Boolean, Optional ByVal ¤l¸ê®Æ§¨¶¥¼h¼Æ As Long = 255)
On Error Resume Next
Dim ¶¥¼h§Ç As Long
Dim ¶¥¼h¼Æ As Long
Dim ¥Ø«e¶¥¼h¸ê®Æ§¨§Ç As Long
Dim ¥Ø«e¶¥¼h¸ê®Æ§¨¼Æ As Long
Dim ¤U¤@¶¥¼h¸ê®Æ§¨¼Æ As Long
Dim ÀÉ®×¼Æ As Long
Dim ¸ê®Æ§¨¸ô®|°}¦C() As String
Dim ¸ê®Æ§¨¸ô®|°}¦C¼Æ As Long
Dim Àɮ׸ê°T°}¦C¼Æ As Long
Dim ¸ê®Æ§¨©ÎÀɦW As String
Erase Àɮ׸ê°T°}¦C
If ¥]§t¤l¸ê®Æ§¨ = True Then
If ¤l¸ê®Æ§¨¶¥¼h¼Æ < 1 Then
¤l¸ê®Æ§¨¶¥¼h¼Æ = 1
ElseIf ¤l¸ê®Æ§¨¶¥¼h¼Æ > 255 Then
¤l¸ê®Æ§¨¶¥¼h¼Æ = 255
End If
¶¥¼h¼Æ = 1 + ¤l¸ê®Æ§¨¶¥¼h¼Æ
Else
¶¥¼h¼Æ = 1
End If
ReDim ¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h¼Æ, 1) As String
¸ê®Æ§¨¸ô®|°}¦C(1, 1) = ¸ê®Æ§¨¸ô®| '¸ê®Æ§¨¸ô®|¥²¶·¸g¹L×¥¿¡Aµ²§À±a\
¤U¤@¶¥¼h¸ê®Æ§¨¼Æ = 1
¸ê®Æ§¨¸ô®|°}¦C¼Æ = 1
ÀÉ®×¼Æ = 0
Àɮ׸ê°T°}¦C¼Æ = 0
For ¶¥¼h§Ç = 1 To ¶¥¼h¼Æ
If Not ¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h§Ç, 1) = "" Then
¥Ø«e¶¥¼h¸ê®Æ§¨¼Æ = ¤U¤@¶¥¼h¸ê®Æ§¨¼Æ
¤U¤@¶¥¼h¸ê®Æ§¨¼Æ = 0
For ¥Ø«e¶¥¼h¸ê®Æ§¨§Ç = 1 To ¥Ø«e¶¥¼h¸ê®Æ§¨¼Æ
¸ê®Æ§¨©ÎÀɦW = Dir(¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h§Ç, ¥Ø«e¶¥¼h¸ê®Æ§¨§Ç) & "*", 31)
Do Until ¸ê®Æ§¨©ÎÀɦW = ""
If Not ¸ê®Æ§¨©ÎÀɦW = "." And Not ¸ê®Æ§¨©ÎÀɦW = ".." Then
If (GetAttr(¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h§Ç, ¥Ø«e¶¥¼h¸ê®Æ§¨§Ç) & ¸ê®Æ§¨©ÎÀɦW) And vbDirectory) = vbDirectory Then
If ¶¥¼h§Ç < ¶¥¼h¼Æ Then
¤U¤@¶¥¼h¸ê®Æ§¨¼Æ = ¤U¤@¶¥¼h¸ê®Æ§¨¼Æ + 1
If ¤U¤@¶¥¼h¸ê®Æ§¨¼Æ > ¸ê®Æ§¨¸ô®|°}¦C¼Æ Then
¸ê®Æ§¨¸ô®|°}¦C¼Æ = ¸ê®Æ§¨¸ô®|°}¦C¼Æ + 99
ReDim Preserve ¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h¼Æ, ¸ê®Æ§¨¸ô®|°}¦C¼Æ) As String
End If
¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h§Ç + 1, ¤U¤@¶¥¼h¸ê®Æ§¨¼Æ) = ¸ê®Æ§¨¸ô®|°}¦C(¶¥¼h§Ç, ¥Ø«e¶¥¼h¸ê®Æ§¨§Ç) & ¸ê®Æ§¨©ÎÀɦW & "\"
End If
Else
If ¸ê®Æ§¨©ÎÀɦW Like ¿z¿ïÀɦW Then
ÀÉ®×¼Æ = ÀÉ®×¼Æ + 1
If ÀÉ®×¼Æ > Àɮ׸ê°T°}¦C¼Æ Then
Àɮ׸ê°T°}¦C¼Æ = Àɮ׸ê°T°}¦C¼Æ + 999
ReDim Preserve Àɮ׸ê°T°}¦C(1, Àɮ׸ê°T°}¦C¼Æ) As String
End If
Àɮ׸ê°T°}¦C(1, ÀÉ®×¼Æ) = ¸ê®Æ§¨©ÎÀɦW
End If
End If
End If
¸ê®Æ§¨©ÎÀɦW = Dir
Loop
Next ¥Ø«e¶¥¼h¸ê®Æ§¨§Ç
Else
Exit For
End If
Next ¶¥¼h§Ç
ReDim Preserve Àɮ׸ê°T°}¦C(1, ÀÉ®×¼Æ) As String
End Sub |
|