Results 1 to 3 of 3

Thread: filelistbox filter on date ? [RSLVD]

  1. #1

    Thread Starter
    Fanatic Member kevin_sauerwald's Avatar
    Join Date
    Feb 2002
    Location
    outside Philly
    Posts
    516

    Resolved filelistbox filter on date ? [RSLVD]

    I know you can filter on type and stuff but is there
    a way to filter on lets say anything one day
    in the past or older ?
    Last edited by kevin_sauerwald; Oct 14th, 2004 at 10:18 AM.

  2. #2
    Lively Member Bootking's Avatar
    Join Date
    Mar 2003
    Location
    Marquette University
    Posts
    90
    I suppose you open a directory with a file listbox and then run through all the files examining them by date and taking out the ones don't want.

    I found this on the internet...

    VB Code:
    1. Private Sub displayFileInfo(ByVal fileName As String)
    2.     Dim fso As New FileSystemObject
    3.     Dim fileSpec As File
    4.     Dim strInfo As String
    5.     Set fileSpec = fso.GetFile(fileName)
    6.     strInfo = fileSpec.Name & vbCrLf
    7.     strInfo = strInfo & "Created: "
    8.     strInfo = strInfo & fileSpec.DateCreated & vbCrLf
    9.     strInfo = strInfo & "Last Accessed: "
    10.     strInfo = strInfo & fileSpec.DateLastAccessed & vbCrLf
    11.     strInfo = strInfo & "Last Modified: "
    12.     strInfo = strInfo & fileSpec.DateLastModified
    13.     MsgBox strInfo, vbInformation, "File Information"
    14.     Set fileSpec = Nothing
    15. End Sub

    So you could do something like this. Fil is your filelistbox and List1 is wehre you put your desired files. You should be able to come up with a way to check the file dates against each other.

    VB Code:
    1. Dim fso As New FileSystemObject
    2. Dim fileSpec As File
    3. For i = 0 to Fil.ListCount - 1
    4.     Set fileSpec = fso.GetFile(Fil.List(i))
    5.     If fileSpec.DateLastModified {Comes after} strMyCutoffDate Then
    6.         List1.Additem (Fil.List(i))
    7.     End If
    8. Next i
    Check out my band's website!
    Walter Walker Band

  3. #3

    Thread Starter
    Fanatic Member kevin_sauerwald's Avatar
    Join Date
    Feb 2002
    Location
    outside Philly
    Posts
    516
    thats kinda the path I took since I figured there was
    no way to do it...

    but I just used the filedatetime function and then
    compared it to now() using datediff using y for day
    of year... if it was negative it was older than one day..

    thanks...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width