SmileeTiger
Programmer
I am attempting to delete log files that are older then a specified dat in Visual Basic. I know I can do this doing something like:
Dim DirName As String
Dim FileDate As Date
DirName = "C:\RDS\rdsbox\boxdata\Temp\Backup"
ChDir DirName
FileName = Dir$("*.*", ATTR_NORMAL)
Do While FileName <> ""
FileDate = FileDateTime(FileName)
If Now - FileDate > 10 Then
Kill FileName
End If
FileName = Dir$
Loop
However Dir$ doesn't go to the next file. Is there a way to either slect files that are older then a specified date or simply have Dir go onto the next file?
Dim DirName As String
Dim FileDate As Date
DirName = "C:\RDS\rdsbox\boxdata\Temp\Backup"
ChDir DirName
FileName = Dir$("*.*", ATTR_NORMAL)
Do While FileName <> ""
FileDate = FileDateTime(FileName)
If Now - FileDate > 10 Then
Kill FileName
End If
FileName = Dir$
Loop
However Dir$ doesn't go to the next file. Is there a way to either slect files that are older then a specified date or simply have Dir go onto the next file?