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 ?
Printable View
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 ?
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:
Private Sub displayFileInfo(ByVal fileName As String) Dim fso As New FileSystemObject Dim fileSpec As File Dim strInfo As String Set fileSpec = fso.GetFile(fileName) strInfo = fileSpec.Name & vbCrLf strInfo = strInfo & "Created: " strInfo = strInfo & fileSpec.DateCreated & vbCrLf strInfo = strInfo & "Last Accessed: " strInfo = strInfo & fileSpec.DateLastAccessed & vbCrLf strInfo = strInfo & "Last Modified: " strInfo = strInfo & fileSpec.DateLastModified MsgBox strInfo, vbInformation, "File Information" Set fileSpec = Nothing 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:
Dim fso As New FileSystemObject Dim fileSpec As File For i = 0 to Fil.ListCount - 1 Set fileSpec = fso.GetFile(Fil.List(i)) If fileSpec.DateLastModified {Comes after} strMyCutoffDate Then List1.Additem (Fil.List(i)) End If Next i
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...
:thumb: