La cosa più ovvia è automatizzare il tutto con una procedura, magari con un VBS:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Logs'} Where " _
& "ResultClass = CIM_DataFile")
dtmCurrentDate = #1/1/1980 8:00 AM#
For Each objFile In colFiles
dtmFileDate = WMIDateStringToDate(objFile.CreationDate)
If dtmFileDate > dtmCurrentDate Then
If strLatestFile <> "" Then
strLatestFile = Replace(strLatestFile, "\", "\\")
Set colOldFiles = objWMIService. _
ExecQuery("Select * From CIM_DataFile Where Name = '" & strLatestFile & "'")
For Each objOldFile in colOldFiles
objOldFile.Delete
Next
End If
strLatestFile = objFile.Name
dtmCurrentDate = dtmFileDate
Else
objFile.Delete
End If
Next
Function WMIDateStringToDate(dtmCreationDate)
WMIDateStringToDate = CDate(Mid(dtmCreationDate, 5, 2) & "/" & _
Mid(dtmCreationDate, 7, 2) & "/" & Left(dtmCreationDate, 4) _
& " " & Mid (dtmCreationDate, 9, 2) & ":" & _
Mid(dtmCreationDate, 11, 2) & ":" & Mid(dtmCreationDate, _
13, 2))
End Function
Lo script, come sempre, va adattato. Seguire le istruzioni sul technet QUI