Option Explicit

Sub dirtst()

    Dim f As String, i As Long
        
    f = Dir("C:\Users\i\Downloads\")
    Cells(1, "A") = f
    i = 2
    Do While f <> ""
    f = Dir
    Cells(i, "A") = f
    i = i + 1
    Loop
    
End Sub

    f = Dir("C:\Users\i\Downloads\*.xlsx") 只返回xlsx文件。