Thread Tools Display Modes
06-11-05, 10:41 AM   #1
Mook
A Murloc Raider
AddOn Compiler - Click to view compilations
Join Date: Jun 2005
Posts: 6
Backup Batch File for Windows

Howdy folks!

In case anyone else will find this useful, I am posting a small batch file I created which will quickly back up all of your important WoW files and folders (Interface, WTF, WDB, Logs, and Screenshots) into a folder named YYYY-MM-DD_HHMM (for example, if you ran the batch file on June 11th at 11:25am, the files would be copied to a folder named "2005-06-11_1125"); the option also exists to compress all the backed up files into a single .ZIP file if you have a licensed copy of WinZip (and the accompanying command line prog, free download from http://www.winzip.com). I am -constantly- messing around with my interface and this batch file has saved me tons of aggravation by making sure I can always 'revert'. Enjoy

** To use, just create a new file in Notepad named 'wowbak.bat' and copy all of the lines below into it. Place a shortcut to 'wowbak.bat' on your desktop, then simply double click it to back up your files. **

REM This batch file will back up all of your important World of Warcraft files and
REM folders in case you ever want/need to revert to earlier settings. All of the 'usual'
REM disclaimers apply to this batch file - it works perfectly for me (on WinXP Pro),
REM but in the unlikely event it causes you any problems, loses your data, or knocks
REM up your girlfriend, I assume NO RESPONSIBILITY WHATSOEVER. If you are
REM not comfortable with that, please do NOT use this batch file.
REM
REM It is assumed that you are saving your backed up files to C:\WoW_BAK,
REM and that your WoW is installed to C:\Games\World of Warcraft. If this is not
REM the case, you will need to change ALL references to match your actual folder
REM structure (for example, change all C:\Games\Worldo~1 to C:\Games\WoW, etc.)

@echo off

REM The first line below sets a variable named 'folder', equal to the current date
REM and time, in the format of YYYY-MM-DD_HHMM. For example, June 11th
REM 2005 at 11:25am would be "2005-06-11_1125". Because this variable
REM incorporates the time (to the minute) as well as the date, this batch file
REM could theoretically be run once every minute without overwriting any
REM previous data (not that you would actually want to do that)

set folder=%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%%time:~3,2%

REM The next section creates a new folder where I want to save these backups
REM named YYYY-MM-DD_HHMM (see above), and also creates subdirectories to
REM mirror the WoW subdirectories we want to save (Interface, WDB, WTF, Logs,
REM and Screenshots). If you don't want to backup a particular folder simply place
REM REM at the start of that line and Save (ie, to not back up your Screenshots folder
REM change "mkdir C:\WoW_BAK\%folder%\Screenshots" to
REM "REM mkdir C:\WoW_BAK\%folder%\Screenshots"

mkdir C:\WoW_BAK\%folder%
mkdir C:\WoW_BAK\%folder%\Interface
mkdir C:\WoW_BAK\%folder%\WDB
mkdir C:\WoW_BAK\%folder%\WTF
mkdir C:\WoW_BAK\%folder%\Logs
mkdir C:\WoW_BAK\%folder%\Screenshots

REM The next section is where your WoW files are actually copied to your backup
REM folders. Note that these lines correspond to the lines above - any "mkdir" lines
REM you REMarked out above should also be REMarked out here. Following the above
REM example, you would change
REM "xcopy C:\Games\Worldo~1\Screenshots C:\WoW_BAK\%folder%\Screenshots /S /E" to
REM "REM xcopy C:\Games\Worldo~1\Screenshots C:\WoW_BAK\%folder%\Screenshots /S /E"

xcopy C:\Games\Worldo~1\Interface C:\WoW_BAK\%folder%\Interface /S /E
xcopy C:\Games\Worldo~1\WDB C:\WoW_BAK\%folder%\WDB /S /E
xcopy C:\Games\Worldo~1\WTF C:\WoW_BAK\%folder%\WTF /S /E
xcopy C:\Games\Worldo~1\Logs C:\WoW_BAK\%folder%\Logs /S /E
xcopy C:\Games\Worldo~1\Screenshots C:\WoW_BAK\%folder%\Screenshots /S /E

REM All of your important WoW files have been copied over at this point - the section below
REM will compress all those files into a single .zip file IF you have a licensed version of WinZip
REM AND have downloaded and installed the free WinZip command line executable (wzcline.exe)
REM from http://www.winzip.com. These lines are REMarked out by default, since not everyone
REM uses WinZip - remove the 'REM' from the start of each line below only if you want to compress
REM your backed up files (and have the necessary WinZip programs).
REM
REM Note that the 5 lines beginning with 'rd' will completely DELETE all of the subfolders you
REM just created! This is fine if you are compressing all your backed up files into a single ZIP first,
REM but if not it will simply delete everything you just copied. So do NOT remove the REM
REM statement from those lines unless you are also zipping them up first!

REM cd C:\WoW_BAK\%folder%
REM wzzip wowbak.zip *.* -r -p
REM rd Interface /s /q
REM rd Logs /s /q
REM rd Screenshots /s /q
REM rd WDB /s /q
REM rd WTF /s /q
  Reply With Quote
06-11-05, 02:39 PM   #2
Nathrakh
A Defias Bandit
Join Date: Jun 2005
Posts: 2
Using Mook's as an example, I made one for 7-zip

backup.bat
Code:
@echo off
for /f "tokens=1,2" %%u in ('date /t') do set date=%%v
for /f "tokens=1" %%u in ('time /t') do set time=%%u
if "%time:~1,1%"==":" set time=0%time%
set folder=%date:~6,4%-%date:~0,2%-%date:~3,2%_%time:~0,2%%time:~3,2%
7za a "C:\Program Files\World of Warcraft\Backups\%folder%.zip" @listfile.txt
listfile.txt
Code:
"C:\Program Files\World of Warcraft\Interface\"
"C:\Progrtam Files\World of Warcraft\Logs\"
"C:\Program Files\World of Warcraft\Screenshots\"
"C:\Program Files\World of Warcraft\WDB\"
"C:\Program Files\World of Warcraft\WTF\"
edit: some times were giving me spaces in the filename, so I found a different method to get the time and date (props to the original author)

Last edited by Nathrakh : 06-14-05 at 01:55 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Released AddOns » Backup Batch File for Windows


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off