(Image: Club Logo) HCC

For the:
Halifax Computer Club
Halifax, Nova Scotia, Canada


All DOS versions have one command that will copy files. Most have more than one. This time, I shall briefly discuss three of the common Copy commands and where it is best to use each. Detail will be kept to a minimum and not all features of each command will be covered. See your DOS manual or on-screen help for more information. This article has Microsoft's DOS versions in mind, but most of this will apply to versions from other manufacturers.


This is the original file copier command. It was introduced in MS-DOS Version 1 (released in August of 1981), and has remained little changed till this day save for some options that have been added. COPY is best for dealing with single or multiple files that total under 64 kilobytes. It has this limitation because when it was introduced, most computers had only a few hundred kilobytes of RAM at the most. COPY can move larger files but only in 64 kb chunks. This means slower operations when a large file or a number of files which total exceeds 64 kb are being copied. On fast computers, this means little, but even so, efficiency counts.

Typical COPY operations might be:

*To copy one or more files from one directory to another, or to a floppy or USB drive:


*To copy a file into the same directory as a different name, thus duplicating the original file. This is useful for creating a backup copy. For that purpose, one might simply change the extension:


COPY has advantages over the other two commands discussed here. It can:

*Combine multiple files into one:


*Can change a file's date and time to the current ones:


*Can copy to & from devices such as a printer (PRN) or the keyboard (CON). This can even be from one device to another such as from a keyboard directly to a printer:

COPY CON FILE.TXT (This places into a file what is typed.) COPY CON PRN (This sends directly to a printer what is typed.)


XCOPY, or "extended" COPY was introduced in MS-DOS 3.2 (January 1986). It allowed larger file chunks to be moved at one time. It also boasted a number of command-line switches. Switches are used to modify DOS commands to do specific things. XCOPY's included, among others, copying for archive file purposes and copying based on file dates. XCOPY has the ability to deal with files in subdirectories, and it is able to create directories if they do not already exist. Thus, it can recreate entire tree structures in a target directory to match those in the source directory.

Switches aside, at that time, an advantage of XCOPY over COPY was that it could read into memory files of any size up to the available amount of Lower memory. Larger files are broken up as with COPY, but the chunks will be the size of that available memory. Thus, XCOPY is best for moving larger files or multiple files that total more than 64 kb.

XCOPY switches numbered 10 by the time MS-DOS 6.22 was released in May of 1994. For DOS versions and emulators running under Windows, a few more have been added. DR-DOS (dee-arr-dos) boasts 14, but the king, however, is Pixelab's after-market version: XXCOPY; it has over 160! Switches are where the true power of DOS lies. See:



This is a dedicated-purpose copy utility that was also brought out with MS-DOS 3.2. It will replace any files of the same name in the target directory with those in the source directory. The real power of REPLACE, though, is with its switches. The `/U' (Update) switch is the most practical. It will only replace files with the same name *if* they are older. So it is most useful for updating files when you want to be assured that the ones kept are the latest versions.

However, if you want to include files not already in the target directory, REPLACE has the `/A' (Add) switch for that purpose. It is handy because if one wants the target to contain the same files as the source, using `/A' means DOS need not recopy files to the target directory that already exist in the source directory.

So using the `/A' and `/U' switches means being selective by not copying files that already exist and are newer, and by copying files existing only in the source. This is very efficient and is best seen when backing up files in a directory where only some have changed and also where new ones may have been added.

To that end, REPLACE can be used to synchronise directories. Here is a batch file that will make sure both directories have the same, complete set of the latest files:

	:: SYNC.bat

	REPLACE directory-1 directory-2 /A
	REPLACE directory-1 directory-2 /U

	REPLACE directory-2 directory-1 /A
	REPLACE directory-2 directory-1 /U


The above first adds files existing only in Directory-1 to Directory-2. It then updates any old files in Directory-2 with newer ones from Directory-1. The process is repeated for Directory-2 in relation to Directory-1. You would substitute your own directory names, of course.

If you want variability of directory names at the command line, in the batch file, substitute `%1' and `%2' for directories 1 and 2, respectively.

In addition, REPLACE can also update files with the same name within any subdirectory via its `/S' switch. Using it means that any file anywhere on your hard drive can be updated with a single operation.

Selecting the right command to do a given task is one of the marks of a power user. DOS and its host of utilities can do the job smoothly and efficiently. Remember:

The Power is at the Command Line!

Richard Bonner is a DOS power user and has his own DOS website:

The DOS Operating System

Forward to: DOS Tips #5

Revert one back to: DOS Tips & Tricks #3

Revert back to the: DOS Tips & Tricks Index

Back to the: Tips & Tricks index