taBackup v1.03
taBackup is a simple backup program. Define file sets or write small scripts to backup your internal disk to a CF-disk, to synchronise two folders, or to perform other stunningly complex tasks.
Read the "Known Problems & Limitations" section. As the main task of this program is copying files, some malfunction could possibly involve accidental deletion of your data. In any case, I cannot be made responsible for any damage, data loss, or whatsoever unintended consequence caused by this program.
Copyright (C) 1999-2001, Thomas Link <thomas.link@a1.net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Or download the GNU-License from:
www.gnu.org/copyleft/gpl.html
Installation
Download the latest distribution from: members.a1.net/t.link/taBackup.html
Handheld: Decompress the zip archive. Copy the sis-file to your Psion or, assuming that you have Psiwin or a similar program installed, connect your Psion to your desktop computer. Now doubleclick on the sis-file.
Emulator: Start the emulator. Doubleclick on the sis-file. Replace the contained opx files with their Intel counterparts, as using the ARM versions of these OPX files with the emulator will result in an error. Download the proper versions of the included OPX files from Symbian's (Sysram1.opx, Systinfo.opx, Alarm.opx: www.symbian.com), and Neuon's (nListBox.opx: www.neuon.com) web sites. Restart the emulator.
- When deinstalling this program, some file in c:\System\Apps\taBackup\ are not deleted. If you think that you won't use taBackup never ever again, remove this directory.
- In the unlikely case that you upgrade from version 1.0, the configuration file (c:\System\Apps\taBackup\config.txt) will be deleted. Make a backup first. The same is true for the catalog file, but as the v1.0 format is not compatible with the new one, you should simply accept the inevitable.
Settings
You have to define file sets or scripts, first. Therefore, you have to edit the configuration file. Press ctrl+f, choose "Config" from the button bar, or "Configure filesets" from the menu. Search the help file for the section "Configuration file" to find out how to define file sets.
On the main screen, tap onto the text area or press the enter key to bring up the main dialog. In case you just want to play around a little bit, choose "Preview" from the "Action" menu.
- Note:
- The names of these options, e.g. 'run faster', are suboptimal. I know.
Action: modes of operation
- Ask: Query user. This might be useful if you only want to backup specific files that could not be defined otherwise
- Run: Log actions page by page
- Run faster: Don't stop at page breaks
- Preview: Show what would be done.
Mode: modes of copying files (A to B)
- Backup: copy if A is newer than B or if B does not exist
- Copy: copy A to B; ask for confirmation if B is newer
- Copy if changed: copy if A and B are different or if B does not exist
- Copy if newer: copy A to B if A is newer than B
- Synchronise: for all files in A and B, choose the file more up to date, or copy A to B if B does not exist
- Synchronise-Bi: as "Synchronise", but also copy B to A, if A does not exist
- Update: for all files in A and B, choose the file more up to date
Backup Set: select a file set or script as defined in the configuration file
Pattern: restrict a backup set using pattern matching:
? matches any single character
* matches any group of characters.
Keep versions: number of older versions you want to keep. As long as you don't have a really large CF-disk, change its value only for specific scripts using the set-command. If you reduce the number of versions you want to keep, superfluous files are deleted. This behaviour can be changed by setting the appropriate option -- see the "Options" section.
Log level: Determines how detailed the log should be. As long as no problems occur, choose level 2.
Catalog, Image
Every file copying action is registered in the catalog. You can review this catalog and restore files from the backup disk.
An "image" is basically the same as a catalog, with the exception that only the files present during the last run are registered. The image is stored in the destination directory.
Both features have to be enabled by selecting the appropriate option -- "Build Catalog" or "Build Image" -- in the preference dialog.
The find command in the browse dialog supports simple pattern matching using the "*"-wildcard.
- Tip:
- Cross-check: use this option in conjunction with "Build catalogs" in order to check for anomalies.
Configuration file
Please be aware that your definitions are not checked for sanity. If you do something wrong, the program either -- likely -- ignores your input or -- possible -- crashes.
- define your own file sets and scripts in "C:\System\Apps\taBackup\config.txt", a plain text
- the configuration file consists of several sections, each ending with a blank line, or containing a specific number of lines
- known sections: [fileset], [script], [uid], [exclude], [options], [virtual paths]
Backup configuration file: use this option to backup "config.txt" and "taBackup.ini" to a backup directory. In case of total data loss copy these files back to "c:\System\Apps\taBackup\". The backup directory is the same as for configuration files, the catalog, images etc.
Example configuration file:
[fileset]
Word Documents
*
C:\**HOME\
D:\Backup\**HOME\
type=Word
[fileset]
ini-Files (System)
*.ini
C:\System\
D:\Backup\System\
[script]
Cleanup
del C:\System\Temp\*
del C:\System\Wtldata\Cache.wtd
[exclude]
C:\System\Temp\*
C:\System\Wtldata\*
[uid]
taBackup=268457420
Backup Sets
- the first file set is the default one -- this is only important for script files, which are opened from the system shell.
- **HOME is expanded to your standard folder's name (this only work in fileset definitions)
- a file set definition consists of four or five lines:
1. title
2. pattern
3. source directory
4. destination directory
(5. additional options)
- Known additional options: type
Example entry:
[fileset]
Standard Folder
*.doc
C:\**HOME\
D:\Backup\**HOME\
type=Word
Exclude Files
- define files or directories that should be excluded from backups in the exclude-section of your configuration file
- you may use wildcards to define excluded files
Example entry:
[exclude]
C:\System\Temp\*
C:\System\Wtldata\*
*\_viminfo
Options
The following options can be defined in the configuration file:
- www = [App name] (web) ... name of web browser -- just in case you want to visit taBackup's fabulous homepage using your Psion.
- editor = [App name] (taBackup) ... name of text editor that should be used for editing plain text files as config.txt.
- escape = [on|off] (off) ... Allow exiting the program by pressing the escape-key
- questions = [text|dialog] (dialog) ... Use text or dialogs for asking questions?
- trim saved versions = [on|off] (on) ... if you change the number of "keep versions", older versions, exceeding the new setting, will be deleted. Set this option to "off" in order to avoid this behaviour.
- external = [dir\] (c:\system\taBackup\) ... The directory where taBackup finds external commands. The external command "test", for instance, refers to the procedure "test$:(arg$)" in the file "[external dir\]test.opo"
- varmarker_pre = [txt] (**); varmarker_post = [txt] () ... If you don't like the way variables are marked, you can change this with these two options. "<" and ">" is a good alternative.
- shortcut action = [Preview|Run|Run faster|Ask] (Ask)
- onrun = [nothing|backupDialog] (backupDialog)
- export dirtables = [on|off] (on) ... when using virtual filenames, export a conversion table as a plain text file (_tBckp.~D~)
- getfiledate = [check|disk|dirtable] (check) ... determine which date information should be used when retrieving a file's date information. Use "check" to use the more recent one -- in case of ambiguities.
- setfiledate = [check|disk|dirtable|no] (check) ... if you copy a file from a virtual file, the deriving date information could be ambiguous. Use this option to adjust the file's date on the disk, in the dir table, or both (=check) if necessary. "No" means: don't set dates.
- gui = [simple|toolbar] (toolbar)
- check device = [on|off] (on)
- loglevel2 = [0-9] (2) ... level used when running scripts from the shell.
Example entry:
[options]
www=web
editor = taBackup
escape = on
Virtual Paths
- Note:
- This feature is experimental.
What is this good for? I have experienced some incompatibilities between Epoc32 and Windows 98 in handling CF-disks. Use this feature for those subdirectories on your CF-card -- do not declare the whole d: drive as a virtual path -- you want to access from different computers.
In the "virtual paths" section of your configuration file you can map virtual paths onto real paths. This sounds better than it actually is, as, at the moment, you can only transform long filenames to shorter ones without blanks.
Each line in the "virtual paths" section defines a virtual path. The syntax is: "protocol:format:path". The conversion information is stored in "c:\System\Apps\taBackup\DirTable.~D~". You can backup this file to the same folder as your catalog. If you "lose" or delete this file, you could run into problems.
It should be possible to reconstruct this file, but this is not implemented at the moment. In addition, there is no way to delete old entries. This means that, if you change the format, the former filename is possibly used nevertheless. I have to think about what to do with files that vanished mysteriously, i.e. without taBackup's intervention.
Protocol: At the moment there is only one protocol available, which is "local".
Format: The elements of the format string are separated by commas. Valid options are:
- "nb" for filenames that must not contain blanks -- use this option if the filenames are truncated when reading your CF-cards under Win98 and the like.
- "fmtX.Y" for formatting the length of a filename, where X is the length of the filename itself, Y the length of its suffix. "fmt0.0" is a valid definition.
- Tip:
- Think about the format you want to use first. It is not a good idea to change it later on.
Path: Paths must not be enclosed in quotes, even if they contain special characters.
Example entry:
[virtual paths]
local:nb,fmt8.3:d:\Backup\Transfer\
local:fmt20.5:d:\Backup\Exchange\
Conversion table: In each subdirectory a file named "_tbBckp.~D~" is created. This is a plain text file containing information about the virtual filename, the real filename, the modification date (as seconds passed since 1.1.1970 adjusted to time zone and summer time, i.e. according to Greenwich Mean Time). It shouldn't be too difficult to write a small script to convert short filenames to their actual ones (ironically called virtual filenames).
- Note:
- If you manually add a file to a directory that is defined as a virtual path, you will also have to edit the corresponding "_tBckp.~D~" file. Otherwise the file will be invisible to taBackup. Set the date value to 0 (zero).
- Note:
- For removing or changing a single entry, you will have to edit _tBckp.~D~ as well as c:\System\Apps\taBackup\DirTable.~D~. The latter one is a data file, which can be edited using programs like PsiDat by Kevin Millican.
Example _tBckp.~D~ file:
#!taBackupConvertXDT
xdt-timestamp=987539512
xdt-version=1
xdt-data:
Test 1.txt*Test_1.txt*971629558
New File*New_File*0
Script Files
- There is a possibility to put scripts into their own files, which can be executed by double-clicking/tapping
- In order to create such a file, select Scripts/New File from the menu. Or choose "New file" from the system shell's menu.
- Shortcuts are a standardised scripts that are generated in a more or less convenient way
Scripts
Scripts contain a series of shell/CLI/DOS like commands. I guess there a better programs around for writing batch scripts, but this didn't keep me from doing my own stuff. Be aware of the fact that most of this is anything else but carefully tested.
- if a path contains a blank space, the file name has to be enclosed in quotes
- absolute pathnames have to be used; there is no "current working directory"
- wildcards may be used as defined in the OPL manual
- more than one command may be put into one line if separated by " : " (space-colon-space) (don't do it)
- If you change some parameter as "keepversions" or "backup mode", you should restore the original settings at the end of the script.
Example entry:
[script]
Example script
bak C:\Startup\ D:\Backup\Startup\
sync C:\System\ HD:PsionBackup:System: *.ini
cp "C:\Startup\Test 1" D:\Backup\Startup\Test_1
del "C:\Startup\Test 1"
if exist * del C:\config.txt
if not exist * md C:\Startup\
if days03 * del C:\config.txt
for c:\bat\* d:; c:\download\* d: \\ if days03 * cp **1 **2
set 1 1
label x
print **v01
add 1 1
if < **v01 10 goto x
[script]
test 1
for C:\OPL\* \\ call "test 2" **1
[script]
test 2
print **a1
UIDs
In your configuration file you can define UIDs, in order to determine the owner of a file. These UIDs are appended to the "File Type" menu.
Example entry:
[uid]
taBackup=268457420
Commands
- cp/copy [from] [to] ... copy
- cpv[N] ... copy and retain N versions of a file
- xcp/xcopy [from] [to] ... performs the same command as "backup" -- at the moment, this is the same as "cp". But hey, this seems to be the same as xbak ... hm
- mv/move/rename [from] [to] ... move (implemented as copy [from] [to] + delete [from])
- del/rm [path] ... delete/remove
- md/mkdir [path] ... create a new directory
- rmdir/rd [path] ... remove directory
- bak/cpic/cpin/sync/syncb/upd [from] [to] [pattern (optional)] ... backup/copy if changed/synchronise/synchronise-bi/update
- xbak/xcpic/xcpin/xsync/xupd [from] [to] ... perform equivalent action with single files; to be used in conjunction with "for", "rundir", or "if"
- rem [text] ... ignore, do not execute
- print [text] ... print a message
- run [*/app] [file] ... open or create a file with a specific application, or with the standard application ("*"), if possible
- pause [n] ... pause execution -- might be useful when running application
- call [script/fileset] [args (optional)] ... backup a fileset or run a script; a script name with blanks in it has to be enclosed in quotes; you can omit the call-command if the script doesn't have the same name as one of taBackup's commands
- rundir [command] [from] [to] [pattern] ... move down a directory tree and call [command] with one (if [to] is set to "") or two arguments. The command is called by appending [from] and [to] to the command name.
- load [file] [script (optional)] ... load a file, and execute a script, or the first one if none is specified. These files have to be located in the external's directory, defined in the "Options" section. For convenience reasons, a valid script file may have "txt" as filename extension. I.e. "load thisScript" would first try to load "thisScript", then "thisScript.txt" -- according to the rules mentioned in the "Externals" section of this wonderfully written manual.
- label [text] ... define a label; the rest of the line is taken as the label's definition; the label text should not contain blanks, " ace;: ace;", "=", or "**"
- goto [text] ... jump back to a previously defined label
- run, runfaster, ask ... switch the way commands are processed.
- restoreaction ... restore the action mode that has previously been changed using "run", "runfaster", or "ask". Using this command a second time restores the actual action mode.
- mode [Backup, Update ...] ... change the backup mode. The names have to written exactly as shown in the main dialog.
- restoremode ... restore the backup mode that has previously been changed using the "mode" command. Using this command a second time restores the actual mode.
- keepversions N ... keep N versions of a file
- restorekeepversions ... reset the number of version kept that has been changed using "keepversions".
- opl [cmd] [arg ...] ... Call an external command, i.e. opl procedure. The external command name "test", for instance, refers to the procedure "test$:(arg$)" in the file "[external dir\]test.opo". This procedure can be called by "opl test arg1 arg2 ...". The arguments are concatenated to one string. Thus, in this example, test$: would be called with the argument "arg1 arg2".
- oplf [slot number] [cmd] [arg ...] ... Does the same as "opl", but the return value of the external procedure is stored in a slot.
Commands to manipulate slots
- set/set$ [slot] [arg] ... if you put a string into a slot, the numeric value of this slot equals to the string's length; this command can also be used to change the backup mode, the action mode, or the number of versions kept ("mode", "action", or "keepversions") from within a script; if you use "set$" these special variables take as argument the names shown in the dialogs; if you use "set", the corresponding number is used
- add/add$ [slot] [arg] ... if you add 1 to "abc", you get 4; if you had used add$, you would have got "abc1"; if you add 0 to "abc1", you get 4
- eval [slot] ... evaluate the textual representation of a slot
FOR
- for [arg11 arg12 ...; arg21 arg22 ...] \\ [cmd **1 **2] ... execute a command for a list of arguments; the first arg may contain wildcards; **N is expanded to the Nth argument in the list; actually, these placeholders are converted to argument slot markers -- see below; up to nine arguments are allowed
IF
- if (not) [test] [*/testarg1 ...] [cmd] [arg1 ...] ... conditional execution of a command; if the test argument is '*', the first argument of the subsequent command will be used instead
known tests:
- exist [path] ... check if a file/dir exists,
- daysNN [path] ... check if a file is older than NN days
- kbNNN [path] ... check if a file is bigger that NNN kilobytes (defined as 1000 bytes)
- is[TYPE] [path] ... checks if a file is of a specific type: Dir, File, Readonly, Hidden, System, Word, Agenda, Data, Program, TextEd, OPL; your own file types can be defined in the uid-section of the configuration file
- =, <, > [NNN] [NNN] ... compare two numbers; in conjunction with label/goto, this can be used to define loops
Slots
A slot or register is a rather simple mechanism to store data for later retrieval. All slots are global. If you want to do something that can't be done this way, implement it as an external opl command.
- there are up to 20 data slots available; a slot is addressed by **vNN -- i.e. **v01 for the first, **v02 for the second slot, and so on.
- slots can be used to pass values to scripts; this is done with the call-command -- see test1 and test2 below; up to nine arguments are allowed; arguments are addressed by **aN -- i.e. **a1 for the first, **a9 for the last argument.
- six additional slots contain information about the last source file and the last destination file processed, i.e. copied, moved or deleted:
Sourcefile/dir/path: **sf, **sd, **sp
Destinationfile/dir/path: **df, **dd, **dp
- some of taBackup's variables can be addressed as slots:
**mode ... nth backup mode
**mode$ ... Name of a backup mode
**action ... nth action mode
**action$ ... Name of a action
**keepversions ... Number of versions to be kept
**loglevel ... Log level
**external ... Path to externals as defined in the option section
**varmarker_pre, **varmarker_post ... string sequences for marking variables
**tabackupdir ... directory into which taBackup was installed
- if you don't want a slot name to be expanded, insert "**pass:[slot]"; this will be expanded to "**[slot]", where "[slot]" is any valid slot name.
Example entry:
[script]
test 1
set$ 1 abc
add 1 1
print **v01 = 4
set$ 1 abc
add$ 1 1
print **v01 = abc1
add 1 0
print v01: **v01 = 4
set 1 1+2
print v01: **v01 = 3
add 1 1+2
print v01: **v01 = 6
set 2 **v01 + 2
print v02: **v02 = 8
set$ 2 **v01 + 2
print v02: **v02 = 6 + 2
eval 2
print v02: **v02 = 8
for C:\OPL\* \\ call "test 2" **1
[script]
test 2
print **a1
External programs
When speaking about connections from taBackup to external programs, I refer to the possibility of (1) calling OPL-procedures from within a taBackup script, and of (2) calling taBackup from some other program. The first one is achieved using the "OPL" or the "OPLF" command. The second can be made easier by using command line switches. In a command line perspective, the syntax for calling taBackup is:
taBackup [path to a taBackup file|option ...]
where "option" is one of the following:
- /call=[script|file set]
- /cmd=[valid taBackup command]
Which is stupid, as any script of file set name is a valid command. If the argument contains a slash ("/"), the whole argument has to be enclosed in single quotes.
External commands (OPL, OPLF) or scripts (LOAD) are searched in the following directories:
- **external (as defined in the "Options" section)
- c:\System\Apps\taBackup
- !:\System\Apps\taBackup (on the disk where taBackup was installed)
For calling taBackup from an OPL program, adapt the following example:
include "system.oxh"
proc test:
local thread&
thread& = runapp&:("OPL", "/call=Test /cmd='print /0' /cmd=pause 0", "Rc:\System\Apps\taBackup\taBackup.app", 0)
endp
DOS, Mac, Unix
The program is aware of different file naming conventions. At the moment, this feature is 100% useless. Nevertheless, possible future uses would be: making a backup to a Mac or Unix computer, to a ftp server etc. EpocSync already does synchronisation via ftp. Thus, I don't think that I will implement any of these features.
Example entry:
[fileset]
Backup to Mac
*
C:\Dokumente\
HD:PsionBackup:Dokumente:
[fileset]
Backup to Unix
*
C:\Dokumente\
~/PsionBackup/Dokumente/
Known Problems, Limitations, and Unexpected Behaviour
- First of all, if a filename, i.e. the full path, is longer than about 220 characters, you possibly run into problems. I don't know any solution to this problem, as we have to pass filenames as ordinary OPL strings to OPL commands. These OPL strings are limited to 255 characters.
- Secondly, this program is written in OPL, which means that it is slow. This is especially the case as I preferred flexibility to efficiency when developing taBackup.
- There are some incompatibilities between Epoc32 and Windows in the handling of CF-disks. As a consequence, the file names of some files saved under Epoc32 appear truncated to 8+3 chars under Windows. It seems as if this problem only occurs when the filename contains blanks. Strange. Anyway, the solution is called virtual paths.
- If you use your CF-disk with different computers, different time settings could confuse taBackup. If you don't take care, you could possibly overwrite a file you edited on one machine with an older version previously being edited on another computer. This seems to be the result of another incompatibility between Windows and Epoc32. Solution: use "Ask" mode, set "Keep older versions" at least to 1, select "Cross-checking", and use virtual paths.
- The whole archive/backup has to fit onto one disk. As the internal memory is usually much smaller than the storage space on a CF-disk, this shouldn't be a problem.
- In some dialogs the keyboard shortcuts are not explicitly named. Press the ctrl key plus the letter in capitals. E.g. "nOne" means pressing ctrl + o. A label with all letters in capitals means 'Enter'. "Cancel" or "Escape" are selfexplanatory. Nevertheless, in some dialogs (those without input boxes) it is sufficient to press the key alone.
- Script lines have to be less then 255 characters long.
- The number of characters in the names of all file set names (excl. scripts) should not exceed 255 minus the number of file sets.
- Only the first instance of taBackup can write to the log file.
Version History
- 1.03 (May 2001)
- virtual paths
- new options & variables
- new commands: restoreaction, restoremode, cd (rather useless at the moment), keepversions, restorekeepversions
- new pref: backup configuration file
- bug fixes: date objects; image names containing certain characters; write log file only if primary instance; pattern matcher; no standard folder (transltPath)
- incompatible change: When writing scripts, commands like "cp", "mv" and the like do no longer handle pattern matching. Use "cpic" or probably "rundir" instead.
- removed option "reconstruct dir structure"
- 1.02 (Oct 2000)
- edit shortcuts
- crosschecks
- options section
- external commands
- "rundir"
- bug fixes
- 1.01
- Several internal changes
- images (partial catalogs)
- version control now works
- 1.0
- "if kbNNN"
- "if isdir"
- slots
- check for file types
- catalog
- label/goto
- version control
- 1.0b1 call; logfile
- 1.0b first public release