Automotive Circuit DiagramsCircuit Diagram SoftwaresHome Automation Circuit Diagrams

Copying in MS-DOS with one drive

MS-DOS with one drive: MS-DOS Is a program developed for controlling a computer system, which it can do with a variety of procedures. One of these is the making of batch files in which a number of commands can be combined to form a new instruction. Batch file a copy copies files from drive A to drive A. A small alteration makes it possible for the instruction to be used with other drives as well. The batch file contains several infrequently used procedures and is intended for systems that have only one diskette drive or have two incompatible drives.

The nature of the alteration can be seen in the listing. It has been assumed that the computer has a hard disk or a RAM disk with sufficient free space. This is because the batch file stores all files to be copied temporarily on the hard disk or RAM disk, The file starts as usual with echo off, and then checks whether the temporary directory already exists and whether it contains any files. If so, the user is warned and asked for a decision.This is effected by the first section of the batch file from if to the label: end if. The if command checks whether the directory is empty with not and exist. If that is the case, the commands up to end if are ignored. If the directory Is not empty, Its content Is shown on the monitor with dir, followed by a message directed to the screen by echo. The pause command gives ample time for a decision to be taken.

After the decision to continue, the content of directory c:\copy.tmp is erased automatically. The question ‘are you sure?’ is diverted to the zero-device (and is, therefore, not displayed) and replied to automatically by `y(es)’. The zero device is a fictitious peripheral, which, as far as the computer is concerned, acts in the same way as a monitor or !minter. It does nothing else and is eminently suitable for use as a wastebasket. The automatic reply )7(es)’ is affected by the echo instruction, whose output (y) with the ‘pipe’ symbol as input is passed on to the delete instruction. The next step Is the creation of sub-directory c:\copy.tmp, which, if all is in order, is not present. Should this directory exist, after all, it will be empty and be therefore usable.

Next, the diskette with the files to be copied is put into drive A. The files that must be copied are identified in the same way as with the MS-DOS copy instruction. No drive letter should be input because that is already in the file.

@echo off

if not exist c:\copy.tmp\*.* goto
dir c:\copy.tmp /w
echo directory C:\COPY.TMP already
echo press ctrl-C to abort ACOPY
echo press any key to delete
echo and continue ACOPY
pause > nul:
echo y I del c:\copy.tmp > nul:
ctty nul:
mkdir c:\copy.tmp
ctty con:
echo Insert SOURCE diskette in drive
copy a:%1 c:\copy.tmp

echo Insert TARGET diskette in drive
copy c:\copy.tinp\. a:%2 > nul:
echo y I del c:\copy.tmp > nul:
rmdir c : \copy. tmp

The batch file cannot be used for 31/2 in and 51/4 in drives: each of these needs its own batch file. The only difference between these two files will be the drive letter in the copy instructions.

Once the files to be copied are stored in the temporary directory, the disks can be exchanged after which the copying can be completed.

Finally, the folders in c\copy.tmp must. be erased and the directory removed

The second copy instruction contains a slop where a *.* might be expected. This full stop, in ms-Dos, means ‘the present directory and may be used in many e cases instead of *.*. For instance, del a is sane as del a:**.

Echo instructions followed by a full stope provide a blank line on the screen. This so even with some other versions MS-DOS, although the manual does no state this.

The syntax of the ACOPY command is

ACOPY pathname (pathname).
Bear in mind that with this method subdirectories must not be copied together with the files.

A last remark: the pathname given from the root directory.


Related Articles

Leave a Reply

Your email address will not be published.

Back to top button