Dec 172017
Backup and restore datafiles from within Clipper. Includes source.
File BACKREST.ZIP from The Programmer’s Corner in
Category Dbase Source Code
Backup and restore datafiles from within Clipper. Includes source.
File Name File Size Zip Size Zip Type
PER_BACK.TXT 2417 1240 deflated
PER_REST.PRG 10742 2983 deflated
PER_BACK.PRG 11979 3245 deflated

Download File BACKREST.ZIP Here

Contents of the PER_BACK.TXT file


by: Per Kjellqvist, HotSoft, Geneva, Switzerland - CS User ID 71540,2311

The common approach to data backup is to simply state in the manual that
all data has to be backed up using either the DOS backup function, or a
backup program such as FastBack. However, my experience has shown me that
very few users follow this tip.

I think that for a database application to be complete it must include
routines to backup and restore datafiles filling more than one floppy disk.

To solve this problem I started by searching the good old NANFORUM to see
if anyone had already written a good Clipper backup utility. All I found
was a demo program that was bigger than 100 Kb. Living in Europe I decided
100 Kb was to expensive for just a demo, so I set out to write the program

I figured out a fairly simple solution using the low level file commands, and
included you will find the two programs:

PER_BACK.PRG -> The backup routine
PER_REST.PRG -> The restore routine

If you like the programs you are free to use them in your applications, but
if you are to include them in a commercial application please send me a line
or two (it is always good to know if your work is appreciated or not).

The method I use very simple but not as elaborate as commercial backup

To back up files you first define the files using wildcards. The names
are read into an array, and the total size in bytes is calculated. The next
step is to copy the files one by one in increments of 1024 bytes (this can
be made bigger or smaller depending on how much memory you want to use for
the buffer) I found the size of this buffer does not really change the speed
much. Once a disk is full the program prompts for a new one, and continues
with the current file where it left off. On each disk I also place a .mem
file with the number of the disk, a unique number for the backup set, and
the total amount of bytes copied in the set.

The recovery works almost the same way but the other way around.

I have also included a few turnkey checks. The program makes sure you don't
put the same disk in twice during the backup, and when recovering it checks
to see that all disks belong to the same set, that the number is correct, and
that it really is a backup disk.

I hope you find these programs useful.

 December 17, 2017  Add comments

Leave a Reply