|
I made up some pure batch files to use WinRAR for simple backups. Uses WinRAR's timestamp switch to append date. Just copy the 4 included files to a new folder, edit the !backup.ini and !backup.lst files with the appropriate details and then run !backup.cmd to create a backup or !restore.cmd to restore the most recent copy.
You can create them yourself with the instructions below or alternatively, just jump to the bottom and download an archive with all four files inside.
!backup.cmd
@echo off setlocal for /f "tokens=2 delims==" %%a in ('find "Filename="^<"!backup.ini"')^ do set rarFilename=%%a for /f "tokens=2 delims==" %%a in ('find "Switches="^<"!backup.ini"')^ do set rarSwitches=%%a for /f "tokens=2 delims==" %%a in ('find "rarPath="^<"!backup.ini"')^ do set rarPath=%%a %rarPath% a %rarSwitches% %rarFilename% @!backup.lst exit
Run this to start a backup. Running this will read data from !backup.ini and !backup.lst to perform the backup so make sure you edit !backup.ini and !backup.lst first.
!backup.ini
Filename=backup-filename_ Switches=-agYYMMDD-HHMMSS -ep1 -m3 -r -s RestorePath=C:\TEMP\ExtractToFolder rarFilePath="C:\Program Files\WinRAR\WinRAR.exe"
* Edit this file just like you would any ini file. Filename will be the name of the backup file.Switches are the command line switches that are past to WinRAR.RestorePath is the path you would like to restore files too. rarFilePath is the path and filename of the WinRAR or RAR application. Do not edit this file.
!backup.lst
D:\apps\filezilla\FileZilla.xml
* Place each file or folder to backup on a seperate line. Wildcards are acceptable.
!restore.cmd
@echo off setlocal for /f "tokens=2 delims==" %%a in ('find "Filename="^<"!backup.ini"')^ do set rarFilename=%%a for /f "tokens=2 delims==" %%a in ('find "RestorePath="^<"!backup.ini"')^ do set RestorePath=%%a for /f "tokens=2 delims==" %%a in ('find "rarFilePath="^<"!backup.ini"')^ do set rarFilePath=%%a for /f "tokens=*" %%a in ('dir /b /od %rarFilename%*') do set rarFile=%%a rarFilePath x "%rarFilename%" * "%RestorePath%" exit
Run this to restore the newest backup to a RestorePath from !backup.ini. Do not edit this file.
|