这个问题这里出现了n多次,建议楼主搜索一下,同时学习一下fso的知识

解决方案 »

  1.   

    使用API啊
    这样的东西确实太多了
    搜索一下吧,兄弟
      

  2.   

    用dir函数就可以,第一次调用成功后,再次调用不带参数,直到返回空字符串。
      

  3.   

    这是我前几日所得,翻翻旧贴就是找着。Public Const MAX_PATH = 260
    Public Const FILE_ATTRIBUTE_DIRECTORY = &H10Public Type FILETIME
            dwLowDateTime As Long
            dwHighDateTime As Long
    End TypePublic Type WIN32_FIND_DATA
            dwFileAttributes As Long
            ftCreationTime As FILETIME
            ftLastAccessTime As FILETIME
            ftLastWriteTime As FILETIME
            nFileSizeHigh As Long
            nFileSizeLow As Long
            dwReserved0 As Long
            dwReserved1 As Long
            cFileName As String * MAX_PATH
            cAlternate As String * 14
    End TypePublic Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
    Public Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
    Public Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
    'Public Declare Function SetCurrentDirectory Lib "kernel32" Alias         "SetCurrentDirectoryA" (ByVal lpPathName As String) As LongSub AllSearch(sPath As String, sFile As String)
        Dim xf As WIN32_FIND_DATA
        Dim ff As WIN32_FIND_DATA
        Dim findhandle As Long
        Dim lFindFile As Long
        Dim astr As String
        Dim bstr As String
        
        lFindFile = FindFirstFile(sPath + "\" + sFile, ff)
        'Debug.Print sPath + "\" + sFile
        If lFindFile > 0 Then
            Do
                Form1.List1.AddItem ff.cFileName
            Loop Until (FindNextFile(lFindFile, ff) = 0)
            FindClose lFindFile
        End If
        'Debug.Print Form1.List1.ListCount
        
        astr = sPath + "\" + "*.*"
        findhandle = FindFirstFile(astr, xf)
        DoEvents
        Do
            If xf.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY Then
                If Asc(xf.cFileName) <> Asc(".") Then
                    bstr = sPath + "\" + Left$(xf.cFileName, InStr(xf.cFileName, Chr(0)) - 1)
                    'Debug.Print bstr
                    AllSearch bstr, sFile
                    
                    'Debug.Print bstr
                End If
            End If
            xf.cFileName = ""
        Loop Until (FindNextFile(findhandle, xf) = 0)
        FindClose lFindFile
    End Sub
      

  4.   

    用filesystemobject就可以 用个递归的编程应该不难
      

  5.   

    dir不够啊,楼上的兄弟
    如果你可以用DIR实现遍历整个目录下的所有文件
    那么,请将你那个用DIR写的函数给大家学习一下好吗?谢谢请注意,问题说的是“目录drives下的所有文件的名称”
    用DIR可以实现吗???