• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Solution for convenient delete the old logs and dumps.

Newbie Spellweaver
Joined
Oct 14, 2008
Messages
29
Reaction score
15
One more my little release of my old stuff.

In 2009 when I was fond of active creation of "my ideal server RYL1",I thought about how to simplify, in a single click, delete all old log files for convenience.

I Found VBScript, little has changed it. For convenient use of directories and file types to remove, duplicated three copies of the script.
And I created a .bat file for easy launch scripts.

An example and description of script:
killd "D:\rylserver\RYLNF\Release\GuildLog\"
killd "D:\rylserver\RYLNF\Release\RylChatServer\"
killd "D:\rylserver\RYLNF\Release\RylGameServer\"
killd "D:\rylserver\RYLNF\Release\RylUIDServer\"
killd "D:\rylserver\RYLNF\Release\RylAuthServer\"
killd "D:\rylserver\RYLNF\Release\RylDBAgentServer\"
killd "D:\rylserver\RYLNF\Release\RylLoginServer\"
killd "D:\rylserver\RYLNF\Release\ManageClient\"
killd "D:\rylserver\RYLNF\Release\RylManageTool\"
killd "D:\rylserver\RYLNF\Release\SetupManage_usa\"
killd "D:\rylserver\RYLNF\Release\ManageServer\"
killd "D:\rylserver\RYLNF\Release\RylSetupServerRun\"
killd "D:\rylserver\RYLNF\Release\Log\"
killd "D:\rylserver\RYLNF\Release\AdminToolClient\"
killd "D:\rylserver\RYLNF\Release\AdminToolServer\"


Function killd(folderspec)
Dim fso, f, f1, fc

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
If (CompareDate(folderspec & f1.name) = True and UCase(Right(f1.name,4)) = ".LOG") Then DelFile(folderspec & f1.name)
Next
End Function
'***************************************************************
Function CompareDate(strFileName)
Dim fso, f, s, i
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(strFileName)

i = DateDiff("d", f.DateCreated, Now)

If i > 1 Then '***Number of Days***
CompareDate = True
Else
CompareDate = False
End If
End Function
'****************************************************************
Function DelFile(strFullFileName)
Dim fso, F
Set fso = CreateObject("Scripting.FileSystemObject")
Set F = fso.GetFile(strFullFileName)
F.Delete
End Function
'****************************************************************

Highlighted in green, you can edit.
In the early lists all the folders in which files should be checked.
Then determine the type of files that are checked.
And in the end is determined, the days of old files to delete.
If you leave the number 1, then after cleaning will remain only today's files.
If you assign the number -1, we will remove all log files and all folders will be empty, I use it, I recommend!

If desired, the standard Windows Task Scheduler to run your .bat file every day or once a week, and then the cleaning will be fully automatic.

I am all these years in the scripts used direct paths, but for your convenience in the archives I have prepared a script with relative paths.
I hope those who will use it will be skilled enough to figure out how to set up their own paths.
Because I do not use the standard architecture of the server folders.

By the way, I would recommend for experienced users who are just starting to create your own server: Try as I, server files + manage tool + admin tool + config tool, all in one folder.
It's really convenient than all in separate folders, and more convenient to adjust the script delete log files.
See screenshot:
my_server_folder_architecture - Solution for convenient delete the old logs and dumps. - RaGEZONE Forums
But then you need to fix one little thing: for the admin tool, change format from one configuration file - AdminServerInfo.txt , .txt to .ini, so that the script of removes the logs did not remove it.
But it just is not enough to change the format, you also need to find and change the references to the file, using HEX editor in AdminManagerServer.exe
But that's another story ...




View attachment deloldlog.zip - Okay, just unpack and put the folder - deloldlog, on par with the release folder.
In .vbs files, configure the correct path.
For cleaning old logs, just run .bat file.
.bat file is not necessary to configure, there are relative paths.
To run from the desktop - create shortcut.
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Mar 2, 2010
Messages
14
Reaction score
0
Re: [Share] Solution for convenient delete the old logs and dumps.

Hmm very nice coding sir, I might try these aswell :)
 
Back
Top