ChrisQuick
Programmer
Hi:
We have an application that generates HTML and jpeg files for a wed-based mapping application. We have a sub routine written to periodically go out and delete these files once the are older than 15 minutes. Here is our code:
Every now and then the application will throw an error "file not found" on the line with the kill statement, so we added the On Error Resume Next, and the Err.Clear hoping it would supress the error and allow the app to keep working. But we are still getting the "file not found" error anyway.
Any ideas on why the On Error Resume Next is being ignored?
Any ideas how a file that supposedly can't be found, can have it's date created returned? After all, we are only trying to delete files older that 15 minutes, so if the file didn't exist, how would we know it's age? cquick@geotg.com
Geographic Information System (GIS), ASP, some Oracle
We have an application that generates HTML and jpeg files for a wed-based mapping application. We have a sub routine written to periodically go out and delete these files once the are older than 15 minutes. Here is our code:
Code:
Private Sub tmrDelete_Timer()
If intTimerCount <= 5 Then
intTimerCount = intTimerCount + 1
Else
Dim strFileName As String
Dim tmpFileObj As Object
Dim tmpFileSpec As Object
Dim tmpFileDateTime As Variant
Set tmpFileObj = CreateObject("Scripting.FileSystemObject")
strFileName = Dir("d:\imsscratch\*.*")
If strFileName <> "" Then
Do Until strFileName = ""
Set tmpFileSpec = tmpFileObj.GetFile("d:\imsscratch\" & strFileName)
tmpFileDateTime = tmpFileSpec.DateCreated
If DateDiff("n", tmpFileDateTime, Now) >= 15 Then
On Error Resume Next
Kill "d:\imsscratch\" & strFileName
Err.Clear
End If
strFileName = Dir
Loop
End If
Set tmpFileObj = Nothing
intTimerCount = 0
End If
End Sub
Every now and then the application will throw an error "file not found" on the line with the kill statement, so we added the On Error Resume Next, and the Err.Clear hoping it would supress the error and allow the app to keep working. But we are still getting the "file not found" error anyway.
Any ideas on why the On Error Resume Next is being ignored?
Any ideas how a file that supposedly can't be found, can have it's date created returned? After all, we are only trying to delete files older that 15 minutes, so if the file didn't exist, how would we know it's age? cquick@geotg.com
Geographic Information System (GIS), ASP, some Oracle