Safeguards Can Help Avoid Computer Disasters

Lawrence J. Magid is vice president and senior analyst at Seybold Group, a computer consulting and publication firm

Almost every computer user I know has a horror story to tell about the time he or she lost important files on a floppy or hard disk.

Sometimes the culprit is mechanical; sometimes it is a software bug. But often it's just plain human error. Regardless, there are things you can do to protect your valuable data and minimize the risk of a catastrophe.

The most important rule is simple: Make backup copies of your data files. For hard disk systems, commercial backup programs make this process quick and easy, but they aren't absolutely necessary. The standard copy command will do nicely.

Sometimes, however, circumstances call for somewhat more sophisticated safeguards. A case in point is the "DOS" operating system that runs IBM PCs and compatible computers. It has two commands--erase and format--that can be very dangerous. If used carelessly, either can destroy all the data on your disk.

As a preventive measure, I've learned to avoid using both commands. Instead, I've written very simple batch files, something anyone can do with any text editor or word processing program, to erase files or format floppy disks.

Batch files are groups of commands stored in such a way that they can be invoked sequentially by typing a single word. They can be big time savers, and they also can be used to control how commands are implemented. In my case, I use batch files to slightly modify the way both the erase and format commands work.

Chance to Back Out

To sidestep the normal erase command, you can set up a batch file called ERA.BAT. It is designed to display a list of files that are about to be erased before they actually are eliminated. Unlike DOS, which in most cases doesn't give users any warning, this batch file gives you a chance to back out if you have made a typing error or have second thoughts about an erasure.

You execute ERA.BAT the same way you use the erase command. If you want to erase all files ending in ".BAK" you type "ERA *.BAK."

ERA.BAT contains these commands: ECHO OFF; CLS; DIR %1; ECHO Any key to erase %1 CTRL C to abort; PAUSE; ERASE %1.

After bringing a warning to the screen indicating which files are about to be erased, these commands display a series of prompts. The first reads, "Strike a key when ready" and suspends the batch file until a key is pressed.

If CTRL C, or CTRL Break, is pressed, DOS automatically asks you if you wish to "Terminate batch job (Y/N)?" If you type "Y," the batch file ends and the files are not erased. Any other key brings you to the last line, which erases the files.

A batch file also can be made to prevent the even worse disaster of accidentally formatting a hard disk and destroying everything on it. Hard disks, which typically store between 10 and 40 megabytes of data (a megabyte is equal to 1 million characters), are normally supposed to be formatted only when first installed.

But it's easy for the format command to wipe out a hard disk. By default, DOS formats whatever drive is active when the format command is used. Since people with hard disks usually keep the hard disk, or Drive C:, as the active drive, simply typing FORMAT can erase the hard drive. Only more recent versions of DOS warn that all data on Drive C: will be lost.

As a precaution, I use the rename command to change the name of the format program, which is normally called FORMAT.COM, to the more ominous DANGER.COM.

The batch file I use to format a floppy is called FORMAT.BAT. It contains the following lines: ECHO OFF; CLS; ECHO You are about to completely erase the disk in drive A:; ECHO If you do not wish to do this press CTRL C; PAUSE; DANGER A:.

When I type FORMAT, a message warns me that I am about to format a disk in drive A:. The pause command displays "Strike a key when ready." If I want to back out, I press CTRL C.

Method of Recovery

Otherwise, the batch file takes me to the line DANGER A:, which formats the disk in A:. Because the batch file contains the A: after the command DANGER, it is impossible for it to format the hard disk.

Even if you don't use these batch files and you accidentally erase files using the erase or delete commands, there may be a way to recover your data. When DOS performs an erasure it's really erasing the listing of the files in the directory. The files are still there, as long as you haven't written new information over them.

A program called Unerase from Peter Norton Computing (2210 Wilshire Blvd., Suite 186, Santa Monica, CA 90403-5784. Phone: (213) 453-2361) can restore erased files. It's best to use Unerase immediately after an accidental erasure since it is possible to write over the area on the disk where the file was located, removing it permanently.

Unerase is one of many handy programs that come on the $99.95 Norton Utilities disk. But although Unerase works in most situations, it is no substitute for a good disaster prevention plan.

Copyright © 2019, Los Angeles Times
EDITION: California | U.S. & World