I'm working on searching error files based on time.
I have 2 folders which have permanent and temporary error files in it, and the only difference between permanent and temporary error files is creation time. I’m searching for error files in these 2 folders and my search should only return permanent error files not the temporary ones. Here is the code snippet.
Dim searchDir2 As New IO.DirectoryInfo("C:\ERROR_FOLDER") Dim fileArray2 As IO.FileInfo() = searchDir2.GetFiles("*.error") Dim fileName2 As IO.FileInfo For Each fileName2 In fileArray2 If fileName2.CreationTime.Date <= curTime Then temp = fileName2.Name temp3 = "C:\ _ERRORS" & temp
I’m working on the if statement but not able to get it working. i want the error files whose creation time is less than 1 hour of the current time. Any help is appreciated.