Originally Posted by
Miino
hello
it doesn't work for me : i have nothing in documents neither in pictures
but in my logs directory it seems to archive a wowcombatlog1.txt and i have a WTF1 folder appearing in my logs directory : is that normal ?
maybe it has something to do with my wow folder being in G and not C, . do i have to edit more things due to the directory ?
That sounds about right. You need to edit the three paths in the first file and the two lines at the top of the second file.
Originally Posted by
ztn
99% ppl need not this wall of text nobody even understand how it's working but only 1 line in bat file like
"c:\program files\winrar\rar.exe" a -r -m5 "G:\wtfbackups\wtf%date%.rar" "d:\games\World of Warcraft\WTF"
When I get a chance later today, I'll do a line-by-line explanation of the second code, which is the batch script. The first code is simply what you get when you export a task from the task scheduler.
Edit: Full explanation of the batch code (second code in the first post). Do not copy this to use in the batch file, it will not work. I used Lua commenting instead of Batch commenting and Windows will not run this. Batch commenting is confusing to those who aren't familiar with code, so I tried to make this readable.
Code:
-- location for the three folders: WoW logs, WoW other, and WoW WTF
set $doc=S:\Documents
-- location for screenshots
set $pic=S:\Pictures
-- batch setting that allows variables to be edited and used within the same loop
setlocal enableDelayedExpansion
-- searches running programs for wow
tasklist | findstr /i /c:"wow.exe" /c:"wow-64.exe"
-- cancels script if wow is still running
if %errorlevel% equ 0 exit
-- changes focus of script to the Logs folder
cd /d "%~dp0Logs"
-- Step 1) checks for a recent chat log, skips to combat check if not there
if not exist WoWChatLog.txt goto combat
-- Step 2) if a chat log exists, check if its empty, and if it is, force-write it to clear file dates, delete it, then go to combat
for %%S in (WoWChatLog.txt) do if %%~zS equ 0 type nul > WoWChatLog.txt & del /f /q WoWChatLog.txt & goto combat
-- Step 3) now that the chat log exists and has text in it, count all the saved chat logs including the new one
for /f %%C in ('dir /b WoWChatLog*.txt ^| find /c /v ""') do set $num=%%C
-- Step 4) delete ChatLog1 if there are 1000 or more chat logs, bringing the total to 999
if %$num% geq 1000 type nul > WoWChatLog1.txt & del /f /q WoWChatLog1.txt
-- Step 5) simple counting variable for the loop below
set $count=0
-- Step 6) counting and renaming loop that will give the new log the highest number and shift everything one down if log1 was deleted
for /f "tokens=*" %%T in ('dir /b /o:d WoWChatLog*.txt') do (
-- ------- increase counting variable by 1 each loop
set /a $count+=1
-- ------- this is where "enableDelayedExpansion" comes into play, !$count! increases each loop
ren %%T WoWChatLog!$count!.txt)
-- the combat section, everything is the same as above, but for the combat logs
:combat
-- Step 1)
if not exist WoWCombatLog.txt goto taint
-- Step 2)
for %%S in (WoWCombatLog.txt) do if %%~zS equ 0 type nul > WoWCombatLog.txt & del /f /q WoWCombatLog.txt & goto taint
-- Step 3)
for /f %%C in ('dir /b WoWCombatLog*.txt ^| find /c /v ""') do set $num=%%C
-- Step 4)
if %$num% geq 1000 type nul > WoWCombatLog1.txt & del /f /q WoWCombatLog1.txt
-- Step 5)
set $count=0
-- Step 6)
for /f "tokens=*" %%T in ('dir /b /o:d WoWCombatLog*.txt') do (
-- -------
set /a $count+=1
-- -------
ren %%T WoWCombatLog!$count!.txt)
-- one more section, this time for taint.log, which is generated when an addon tries to do something the UI doesn't allow
:taint
-- Step 1)
if not exist taint.log goto files
-- Step 2)
for %%S in (taint.log) do if %%~zS equ 0 type nul > taint.log & del /f /q taint.log & goto files
-- Step 3)
for /f %%C in ('dir /b taint*.log ^| find /c /v ""') do set $num=%%C
-- Step 4)
if %$num% geq 1000 type nul > taint1.log & del /f /q taint1.log
-- Step 5)
set $count=0
-- Step 6)
for /f "tokens=*" %%T in ('dir /b /o:d taint*.log') do (
-- -------
set /a $count+=1
-- -------
ren %%T taint!$count!.log)
-- the file section, which copies everything else
:files
-- copies the .bat file to WoW other
robocopy "%~dp0." "%$doc%\WoW other" *.bat
-- copies the Fonts folder to WoW other
robocopy "%~dp0Fonts" "%$doc%\WoW other\Fonts" /E
-- copies all chat/combat logs to WoW logs
robocopy "%~dp0Logs" "%$doc%\WoW logs" WoW*Log*.txt
-- copies all taint logs to WoW logs
robocopy "%~dp0Logs" "%$doc%\WoW logs" taint*.log
-- copies screenshots to WoW screenshots
robocopy "%~dp0Screenshots" "%$pic%\WoW screenshots"
-- copies the Sound folder to WoW other
robocopy "%~dp0Sound" "%$doc%\WoW other\Sound" /E
-- restores any missing chat/combat logs back to WoW\Logs
robocopy "%$doc%\WoW logs" "%~dp0Logs" WoW*Log*.txt
-- restores any missing taint logs back to WoW\Logs
robocopy "%$doc%\WoW logs" "%~dp0Logs" taint*.log
-- restores the .bat file to WoW folder
robocopy "%$doc%\WoW other" "%~dp0." *.bat
-- restores the Fonts folder to WoW folder
robocopy "%$doc%\WoW other\Fonts" "%~dp0Fonts" /E
-- restores the Sound folder to WoW folder
robocopy "%$doc%\WoW other\Sound" "%~dp0Sound" /E
-- restores any missing screenshots to WoW\Screenshots
robocopy "%$pic%\WoW screenshots" "%~dp0Screenshots"
-- changes focus of script to the WoW WTF folder at wherever you put the path at the very top of this script
cd /d "%$doc%\WoW WTF"
-- creates a blank WTF folder there
md WTF
-- counts the saved WTF folders
for /f %%C in ('dir /b WTF* ^| find /c /v ""') do set $num=%%C
-- deletes the oldest WTF save if there are 10, just like Step 4 in the logs
if %$num% geq 10 rd /s /q WTF1
-- another counting variable
set $count=0
-- another counting and renaming loop, does the same thing as the logs
for /f "tokens=*" %%T in ('dir /b /o:d WTF*') do (
-- -------
set /a $count+=1
-- -------
ren %%T WTF!$count!)
-- now that the new WTF folder has the highest number, the last thing the script does is copy the real WTF folder to this new WTF# folder
robocopy "%~dp0WTF" "%$doc%\WoW WTF\WTF%$count%" /E