Totally simple DOS backup on the File menu
Thursday, July 17, 2008 8:40:00 AM
You know you should but... well, let there be no excuse: just do it. A little DOS utility for people using Opera on Windows. Put it on your File menu: one click and done - runs in a few seconds (unless you copy your mail archive - that can take a couple of minutes). A decent safety net, with three levels of save.
Copies the files that define your Opera (bookmarks, mail, notes, wand, preferences, history, sessions, speed dial and customization files) into a backup folder. Prompts for two further levels of backup - one copies the folder into a stack of five safe from further overwriting (giving you dated snapshots of your system from which you can restore if necessary), the other copies it to the desktop, for you to stash somewhere safe.
Setup is by copy and paste, and requires correcting paths to your Opera, mail and desktop folders.
It's meant to be quick and simple. It doesn't save bulky non-critical things (skins, images, cache or VPS). A DOS window pops up, zip through the copies, and prompts about stack & desktop copy. When done it looks like this:
You'll see the backup folder sitting beside your Opera folder. In it (once you've done a few saves) are six subfolders: Latest, and the stack, 1-5. You can use it freely without concern about accumulating garbage: basic saves only overwrite files in Latest which have changed, and stack saves delete the oldest subfolder, so the backup folder doesn't grow.
If you have a lot of mail, it takes a while to copy. You might consider separating mail backup. To do that, make a second copy of the program called Bakmail, then delete the mail line from Bakopera and all the other xcopy lines (except the copy-to-desktop one) from Bakmail.
If you want a more elaborate program which will manage its own setup or encrypt or compress, you can try one of these:
OperaBackup 990 KB
OSIE (Opera Settings Import & Export Tool) 541 KB
Operafly by Jgamer. 441 KB
Opera backup list and WinRAR command line shortcut creator by Tamil. 201 KB
Opera Backup Crossroads Web Design 4MB
By contrast, what you copy off the screen here is 1 KB - the other programs are hundreds or thousands of times longer.
Set up the "run Bakopera" command
- decide where you're going to store BakOpera. Easiest is to make a C:\utility folder - which is what my commands (below) assume. Otherwise, change path in the command to whatever folder you're using (the button has the command inside - if you don't know how to edit buttons, best stick with c:\utility).
- to put the the command on a menu (I use the file menu), copy the following line (light and dark blue) into the appropriate menu section (here's Tamil's tip on INI file editing if you've never done it):
Item, "Backup"= Execute program, "c:\utility\BakOpera.bat"
- to attach it to a keystroke or mouse gesture, copy only the light blue, then paste it into the Action field in the customization dialogue (Tools / Prefs / Advanced / Shortcuts).
- to put it on a toolbar, drag this to the bar: BakOpera
Set up the program
- copy the program (what's in blue, below)
- open the folder in which you've decided to keep Bakopera
- rightclick inside the folder / New /text file: a shortcut appears, default name selected for replacement
- type in the new name: BakOpera.bat
- press Enter. A prompt asks if you really want to change the extension: yes.
- rightclick the shortcut & select Edit. Notepad (or your other designated plain-text editor) will open.
- paste, save, and close.
This version works with Windows XP and Opera 10. A few filenames differ in older Opera versions (Opera6.adr=bookmarks Opera6.ini=prefs global.dat=history), and DOS commands vary a little between Windows versions (Choice instead of Set /p).
: info - vlink4.dat=link history (back/forward)
@cd C:\"Documents and Settings\username\Application Data"\Opera\Opera
xcopy C:\"Documents and Settings\username\Local Settings\Application Data"\Opera\Opera\mail ..\backup\latest\mail\ /s /d /y
xcopy menu ..\backup\latest\menu\ /d /y
xcopy keyboard ..\backup\latest\keyboard\ /d /y
xcopy toolbar ..\backup\latest\toolbar\ /d /y
xcopy mouse ..\backup\latest\mouse\ /d /y
xcopy sessions ..\backup\latest\sessions\ /d /y
xcopy Operaprefs.ini ..\backup\latest\ /d /y
xcopy bookmarks.adr ..\backup\latest\ /d /y
xcopy contacts.adr ..\backup\latest\ /d /y
xcopy notes.adr ..\backup\latest\ /d /y
xcopy global_history.dat ..\backup\latest\ /d /y
xcopy wand.dat ..\backup\latest\ /d /y
xcopy vlink4.dat ..\backup\latest\ /d /y
xcopy speeddial.ini ..\backup\latest\ /d /y
@set /p X= Copy backup folder into stack? 1:yes 2:no :
@if '%X%'=='2' goto desktop
@deltree /y 5
@rename 4 5
@rename 3 4
@rename 2 3
@rename 1 2
xcopy latest 1\ /s
@set /p X= Copy backup folder to desktop? 1:yes 2:no :
@if '%X%'=='2' goto end
xcopy latest c:\"documents and settings"\username\desktop\OperaBAK\ /s /d /y
@echo Backup complete.
- put in correct username. Make sure the initial CD command points to your Opera folder - the one listed on Help / About Opera / Opera directory
- all these files and folders are in the Opera folder on my system, but it's possible to put some elsewhere and if so you will need to correct their paths. Only change the source (the part right after xcopy) - leave the target (the part after the second space) as is
- simplest thing is to use absolute paths - i.e., starting with the drive letter. Just the normal address to the file or folder
- when the source is a file, it should end with a three-letter extension; when it's a folder, no extension.
- paths which include spaces require use of quotes. It's OK to quote the whole path, or individual folder names.[/COLOR]
Look it over. If you have put significant time into some file such as search.ini or an ad block list which isn't here, you should add it to the program. I've added my custom dialog.ini, for example.
The first few times you save to the stack, there will be messages saying "file not found" - because commands were issued to delete and rename folders which don't exist yet. This does no harm, and will stop after five stack saves, once the stack has been built.
Background: DOS quirks, commands, switches
- a bug in XP DOS: xcopy doesn't work if source folder spec ends in a backslash (did in older DOS).
- @ before a command: don't "echo" - that is, don't put it on screen: just do it.
- /s: copy all subfolders, unless empty. In XP, seems to cause command to fail if there are no subfolders.
- /d: only copy things which are newer than the version in the target location, if there is one.
- /y: overwrite older versions without prompting for confirmation
- $G: "greater than" (the command sets the prompt you see at the start of each line)
- cd: "change directory". Tells DOS what the "working folder " is: the starting point to use in interpreting relative paths.
- .\: working folder ..\:parent of working folder ...\:grandparent of working folder (etc.)
- Xcopy creates the target folders it needs if they don't exist.