Skip to main content

AccessTr.neT


Klasördeki Dosyaları Listboxa Alırken Oluşturma Tarihine Göre Sıralamak

Klasördeki Dosyaları Listboxa Alırken Oluşturma Tarihine Göre Sıralamak

Çözüldü #1
Klasördeki dosyaları listboxa alırken oluşturma tarihine göre Z-->A sıralayarak almak nasıl olmalı
şu kod dosyaları alıyor


Public Function FillDirToTable(lst As listbox, colDirList As Collection _
                                , ByVal strFolder As String _
                                , strFileSpec As String _
                                , bIncludeSubfolders As Boolean _
                                , Optional criteria As String = "")
On Error GoTo Err_Handler

    Dim strTemp As String
    Dim colFolders As New Collection
    Dim vFolderName As Variant

    strFolder = TrailingSlash(strFolder)

    'strTemp returns the FileName matching the FileSpec in strFolder
    strTemp = Dir(strFolder & strFileSpec)      'produces ..Folder\*.FileSpec

    Do While strTemp <> vbNullString        'as long as FileNames are returned
       
        If (InStr(strTemp, criteria) > 0 Or criteria = "") Then lst.AddItem strFolder & strTemp
       
        strTemp = Dir      'Recursively call the Dir() Function
    Loop
   
    If bIncludeSubfolders Then
        strTemp = Dir(strFolder, vbDirectory)
        Do While strTemp <> vbNullString
            'If Sub-Folder, add to colFolders Collection
            If (strTemp <> ".") And (strTemp <> "..") Then
                If (GetAttr(strFolder & strTemp) And vbDirectory) <> 0& Then
                    colFolders.Add strTemp
                End If
            End If
            strTemp = Dir          'Recursively call the Dir() Function
        Loop
   
        'Call function recursively for each subfolder.
        For Each vFolderName In colFolders
            '..Folder\Sub-Folder\----------------'
            Call FillDirToTable(lst, colDirList, strFolder & TrailingSlash(vFolderName), strFileSpec, True)
        Next vFolderName
    End If
   
   

Exit_Handler:
  Exit Function

Err_Handler:
  Resume Exit_Handler
End Function
@benbendedeilem
Son Düzenleme: 22/05/2020, 16:15, Düzenleyen: accessman.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Klasördeki Dosyaları Listboxa Alırken Oluşturma Tarihine Göre Sıralamak - Yazar: accessman - 22/05/2020, 16:14
Task