Classic Computer Magazine Archive COMPUTE! ISSUE 126 / FEBRUARY 1991 / PAGE 76

Don't wait for DOS, get a move on. (disk operating system) (Introdos)
by Tony Roberts

One of DOS's notorious failure is its inability to move a file from one subdirectory to another. You must copy the file to the destination and then erase the original from the source subdirectory. Microsoft, aware of this deficiency, has included move options in its DOS 4.01 SHELL and in Windows.

Maybe future versions of DOS will have a true move command, but in the interim, there are workarounds. The most effective solution is to locate a move program, add it to your DOS subdirectory, and use it as if it were part of DOS.

Commercial software producers often included handy utilities as bonus programs. Make it a practice to examine all files on all disks whenever you buy new software. You may uncover some gems.

If you telecommunicate, investigate the utilities libraries of the bulletin boards or services you call for a public domain or shareware program that will automate file moving.

Another solution to the move dilemma is to create a batch file to do the copying and deleting for you. In simplest form, this batch file requires only two lines:

COPY %1 %2

ERASE %1

This solution, however, opens the door for disaster. Specify an incorrect destination for the %2 parameter, and the files will not be copied properly. The second line, unaware of the problem, blindly erases all the source files.

MOVE. bAT builds is error traping by making sure the proper number of parameters (two) are supplied and by verifying that the destination subdirectory is valid. Other problems remain to be solved, though. What happens if files of the same name already exist at the destination? How can the program make sure all files were copied safely before erasing the originals?

A commercially prepared move utility will anticipate these and other problems and will help you skirt trouble. It is possible, though, to do quite well with a self-constructed batch file. Just be sure to verify the results of each operation and have an undelete program handy in case you make a mistake.

Another of DOS's unflattering points is that it responds nastily when you use the TYPE command to view the contents of an EXE or COM file. How many times have you run across a program that you couldn't identify or that you didn't know how to use? If only you could type the file, you could uncover some clues.

With DOS, you received a program called DEBUG that can help you of this fix. DEBUG is primarily a program development tool, but serious programmers probably bypass DEBUG in favor of more powerful, easier-to-use utilities. Nevertheless, DEBUG provides a quick, inexpensive way to peek a program files.

To use DEBUG , type DEBUG filename, specifying the name of the file you want to examine. DEBUG provides you with a hyphen as a prompt. Press D and Enter, and the first 128 bytes of the file will be displayed in both hexadecimal and ASCII format. Don't worry about the hex numbers; just watch the ASCII area on the right side of the screen for anything that looks like English.

I nothing looks familiar, press D and Enter again to dump the next segment of the file. Continue the process until you uncover some clues. Although most of the program appears to be gibberish, you will find sections that contain decipherable information such as error messages, instructions, or copyright notices.

When hunting through a mystery file, watch for ASCII letters or commands that begin with slashes (/). These are often lists of acceptable command line parameters that can help you figure out how to run the program. If you find the parameter that triggers the program's HELP screen (if it has one), you're in luck.

When you've finished examining the file, press Q to return to DOS.

DOS has its shortcoming, but it does provide a good set of basic tools. With the programs available in DOS and a little batch programming, you can find a solution for most filemanagement problems. If you're constantly doing specially work, however, go out and find the utility software you need to extend DOS's functions.

REM MOVE.BAT echo off if (%2) = = got help if not exist %2 \*.* goto nodest dir %1 /w echo These files will be moved to %2. echo Pres Crtl to cancel this

operation or pause copy %1 %2 erase %1 goto end :nodest echo The desination subdirectory does

not exist on current path. got end :help echo USAGE: MOVE filename

destination :end