Jump to content

[Request] schedule deletion of logs


Piper

Recommended Posts

I have searched and right now we are set up to delete all by the click of a button ..How ever i was wondering if there was a script that would enable us to schedule this task ? Because it would also eliminate the need for a restart script since the "game application/server" reboots when the logs get deleted .

 

All and any help in this matter is greatly appreciated .

 

Thank you .

Link to comment
Share on other sites

They said they were already setup to delete log files just not on a schedule and the answer for that is Windows task scheduler. TcAdmin doesn't have a task scheduler built into it, and there realy isn't any need for one iether. As for deleting files I use the following script, altering the location as pertinent.

Option Explicit
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
DeleteFiles fso.GetFolder("C:\userfiles\rugunno\tc.......")
Sub DeleteFiles(srcFolder)
Dim srcFile
If srcFolder.Files.Count = 0 Then
Exit Sub
End If
For Each srcFile in srcFolder.Files
If DateDiff("d", Now, srcFile.DateCreated) < -30 Then
fso.DeleteFile srcFile, True
End If
Next
End Sub

 

This script also utilizes a time delay allowing me to have log rotation, and if I don't wish to retain any logs I just set the time delay to nothing.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use