The reason

I’ve started recording my dungeon runs in the combat log, so i can investigate my parses and become better. However I’ve run into an annoying little issue. I’m terrible at clearing my combat log after a session. The WarCraft Logs uploader might have an option to delete your log after you’ve uploaded it, but the file is often in use by the game. And I can assure you, I’m not gonna remember to do it after I close the game down. The solution, backup the log for 30 days when I shutdown my computer, and delete the old one. For most days, this would create 1 log pr. day. That seems ideal to me.

Getting Dragonwrath, Tarecgosa's Rest

Getting Dragonwrath, Tarecgosa’s Rest

The solution

The solution is simple, create a batch script that does all we just said, and setup a Group policy to run the script every time we log off the computer.

The script

Copy to Clipboard

The script itself isn’t complicated and should run right out the box, you only need to fill in the square brackets with the path to your Wow installation, and the folder you intend to keep backed up.

For most people it would look something like this:

set Source=”C:Program Files (x86)World of Warcraft_retail_LogsWoWCombatLog.txt”

set Destination=”C:Program Files (x86)World of Warcraft_retail_LogsLogoff Backups”

When done save the script as a .bat file and placed it somewhere you can remember, I recommend just throwing it in the logs folder inside the WoW folder for conveniences sake.

If you want to understand the script better, here is a commented version of it:

Copy to Clipboard

The GPO

You can do this with the task scheduler as well, but I already use GPOs to do various things and doing it here I can keep most of it in one place.

Start by pressing Windows button + R to open the run window, in the window you type “gpedit.msc”:

In the window that comes up, unfold “Windows Settings” under “computer settings” and click on “Scripts”

Double click the “shutdown” item in the window on the right.

In the next window, click the “add” button.

Then browse to our script file, when you’ve found it, click OK, and then OK again.

Congratulations, you’re done. Assuming you tested the script, it will now run when the PC shuts down, backing up the old file, and deleting any log files older than 30 days,