Here is a module Save as ModFSO
Code:
Function FSODateLastModified(AnyFile As String) As String
Dim FSO As New FileSystemObject, FileInfo As File
If Dir(AnyFile) <> "" Then
Set FileInfo = FSO.GetFile(AnyFile)
FSODateLastModified = CStr(FileInfo.DateLastModified)
Else
FSODateLastModified = "Unknown"
End If
End Function
Function FSOFindFiles(sFol As String, sFile As String)
Dim tFld As Folder, tFil As File, FileName As String
Dim DLM As String, tPath As String
Dim fld As Folder, fType As String
Dim FSO As New FileSystemObject, FileInfo As File
On Error GoTo Catch
If FSO.FolderExists(sFol) Then
Set fld = FSO.GetFolder(sFol)
FileName = Dir(FSO.BuildPath(fld.Path, sFile), vbNormal Or vbReadOnly)
While Len(FileName) <> 0
FindFile = FindFile + FileLen(FSO.BuildPath(fld.Path, FileName))
tPath = FSO.BuildPath(fld.Path, FileName)
Set FileInfo = FSO.GetFile(tPath)
DLM = CStr(FileInfo.DateLastModified)
fType = CStr(FileInfo.Type)
If IsLoaded("FrmWzdMainDetails") Then
If Right(FileName, 3) <> "tmp" Then
FrmWzdMainDetails.ctList1.AddItem FileName + ";" + DLM + ";" + fType
End If
End If
FileName = Dir()
DoEvents
Wend
End If
Exit Function
Catch: FileName = ""
Resume Next
End Function
Function FSOFindDocs(sFol As String, sFile As String)
Dim tFld As Folder, tFil As File, FileName As String
Dim DLM As String, tPath As String
Dim fld As Folder, fType As String
Dim FSO As New FileSystemObject, FileInfo As File
On Error GoTo Catch
Set fld = FSO.GetFolder(sFol)
FileName = Dir(FSO.BuildPath(fld.Path, sFile), vbNormal Or vbHidden Or vbSystem Or vbReadOnly)
While Len(FileName) <> 0
FindFile = FindFile + FileLen(FSO.BuildPath(fld.Path, FileName))
tPath = FSO.BuildPath(fld.Path, FileName)
Set FileInfo = FSO.GetFile(tPath)
DLM = CStr(FileInfo.DateLastModified)
fType = CStr(FileInfo.Type)
' FrmContractDetails.ctList4.AddItem FileName + ";" + DLM + ";" + fType
FileName = Dir()
DoEvents
Wend
Exit Function
Catch: FileName = ""
Resume Next
End Function
Function PathExists(sFol As String) As Boolean
Dim FSO As New FileSystemObject
PathExists = FSO.FolderExists(sFol)
End Function
Function CreateNewFolder(sFol As String)
Dim FSO As New FileSystemObject
FSO.CreateFolder sFol
End Function
Function CopyFiles(sDoc As String, dDoc As String)
Dim FSO As New FileSystemObject
FSO.CopyFile sDoc, dDoc, True
End Function
You can use the date last modified to compare the dates. You may also need to reference the Miscrosoft Scripting Runtime object.
David