help.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
XCOPY
Notes  Examples
────────────────────────────────────────────────────────────────────────────
 
                                   XCOPY
 
Copies directories, their subdirectories, and files (except hidden and
system files).
 
With this command, you can copy all the files in a directory, including the
files in the subdirectories of that directory.
 
Syntax
 
    XCOPY source [destination] [/Y|/-Y] [/A|/M] [/D:date] [/P] [/S] [/E]
    [/V] [/W]
 
Parameters
 
source
    Specifies the location and names of the files you want to copy. Source
    must include either a drive or a path.
 
destination
    Specifies the destination of the files you want to copy. Destination can
    include a drive letter and colon, a directory name, a filename, or a
    combination.
 
Switches
 
/Y
    Indicates that you want XCOPY to replace existing file(s) without
    prompting you for confirmation. By default, if you specify an existing
    file as the destination file, XCOPY will ask you if you want to
    overwrite the existing file. (Previous versions of MS-DOS would simply
    replace the existing file.) If the XCOPY command is part of a batch
    file, XCOPY will behave as in previous versions. Specifying this switch
    overrides all defaults and the current setting of the COPYCMD
    environment variable.
 
/-Y
    Indicates that you want XCOPY to prompt you for confirmation when
    replacing an existing file. Specifying this switch overrides all
    defaults and the current setting of the COPYCMD environment variable.
 
/A
    Copies only source files that have their archive file attributes set.
    This switch does not modify the archive file attribute of the source
    file. For information about how to set the archive file attribute, see
    the ATTRIB command.
 
/M
    Copies source files that have their archive file attributes set. Unlike
    the /A switch, the /M switch turns off archive file attributes in the
    files specified in source. For information about how to set the archive
    file attribute, see the <ATTRIB> command.
 
/D:date
    Copies only source files modified on or after the specified date. Note
    that the format of date depends on the COUNTRY setting you are using.
 
/P
    Prompts you to confirm whether you want to create each destination
    file.
 
/S
    Copies directories and subdirectories, unless they are empty. If you
    omit this switch, XCOPY works within a single directory.
 
/E
    Copies any subdirectories, even if they are empty.
 
/V
    Verifies each file as it is written to the destination file to make sure
    that the destination files are identical to the source files.
 
/W
    Displays the following message and waits for your response before
    starting to copy files:
 
    Press any key to begin copying file(s)
 
Related Command
 
For information about copying individual files, see the <COPY> command. For
information about copying disks, see the <DISKCOPY> command.
 
                                      ♦