YourDictionary

DOS Xcopy - technical definition


An external command starting with DOS 3.2 that copies files and subdirectories. The following examples copy from the root directory on C to the D drive:

 C:\>xcopy *.* d:      all files in the root

 C:\>xcopy *.* d: /s   all files and subdirectories
                        that contain files

 C:\>xcopy *.* d: /s /e   all files and all
                           subdirectories (whether
                           empty or not)


To be prompted each time Xcopy copies a source file, add /p:
          xcopy *.* d: /s /e /p


To be extra sure the copy is correct, add the /v switch, which compares the new file with the old one; for example:
          xcopy *.* d: /v


Xcopy can copy files and create a new directory at the same time. The following example creates the NEW directory and copies all the files from the OLD directory:
       C:\OLD>xcopy *.* \new


ARCHIVING FILES
Use Xcopy's /m switch to back up only files that have been changed since the last time they were Xcopied. This works only on files that have been Xcopied at least once before and will not work on un-Xcopied files.

When Xcopy copies a file, it resets the original file's archive bit from 1 to 0. For more on archive bits, see DOS Attrib. Whenever you update a file, the archive bit is set to 1. When you use the /m switch, Xcopy copies only files with the archive bit set to 1.

The following example backs up all files onto the B disk:
             xcopy *.* b: /m


ARCHIVE ONTO MULTIPLE FLOPPIES
You can use the Xcopy and Attrib commands to copy files onto multiple diskettes, providing no single file is larger than the total size of the diskette. In that case, you have to use the Backup command or other Backup utility.

The Attrib command is used to set all archive bits on. When a file is copied, the bit is turned off. Each time Xcopy does not have enough room to copy the next file, you will get a "Disk Full" message. Put in another blank disk and repeat the Xcopy command. The archive bit keeps the previously copied files from being copied again.

For example, to copy all the files in the DOCS directory onto floppies, type:
    C:\DOCS>attrib +a *.*      do this once
    C:\DOCS>xcopy *.* b: /m    repeat until done



ARCHIVE ONE HARD DISK TO ANOTHER
The following example copies everything from the C: drive to the D: drive that has changed since the last time the files on C: were Xcopied. This includes the root and all subdirectories. The /s switch is used here in order to include all subdirectories.
         xcopy c:\*.* d:\  /s /m


Note!


In versions previous to DOS 5, Xcopy copies hidden and system files. Starting with DOS 5, you must remove the hidden and system attributes with Attrib first.



link/cite print suggestion box