Xcopy
Copies files and directories, including subdirectories.
xcopy source [destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/d[:date]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [/a|/m] [/n] [/exclude:filename] [/z]
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.
/w
Displays the following message and waits for your response before starting to
copy files:
Press any key to begin copying file(s)
/p
Prompts you to confirm whether you want to create each destination file.
/c
Ignores errors.
/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. This switch is ignored
because the functionality is inherent to the Windows NT operating system. The
switch is accepted only for compatibility with previous versions of MS-DOS.
/q
Supresses display of xcopy messages.
/f
Displays source and destination filenames while copying.
/l
Does not copy files, only displays (lists) files that would be copied.
/d[:date]
Copies only source files changed on or after the specified date. If the date value is missing, xcopy copies all source files that are newer than the time of existing destination files. This option allows you to update only files that have changed. If you
specify a date, use a "-" as the separator rather than a "/" so that the date
is not interpreted as another parameter.
/u
Copies (updates) only files from source that exist on destination.
/i
If source is a directory or contains wildcards, and destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory then copies all
specified files into the new directory. By default, xcopy will prompt you to specify whether destination is a file or directory.
/s
Copies directories and subdirectories, unless they are empty. If you omit this
switch, xcopy works within a single directory.
/e
Copies all subdirectories, even if they are empty. Used with the /s and /t switches.
/t
Copies only subdirectory structure (tree), not files. To copy empty
directories, you must include the /e switch.
/k
Copies files and retains the read-only attribute on destination files if
present on the source files. By default, the read-only attribute is removed.
/r
Copies over read-only files.
/h
Copies files with the hidden and system file attributes. Xcopy will not copy hidden or system files by default.
/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.
/n
Copies using NTFS short file or directory names. This switch is required when
copying files or directories from an NTFS volume to a FAT volume or when the
FAT file system naming convention (8.3) is required on the destination volume.
The destination file system may be FAT or NTFS.
/exclude:filename
Excludes the files listed in the specified file from the copy operation. The
exclusion file can have a list of exclusion patterns (one per line, no wild card
characters are supported). If any exclusion pattern in the file matches any
part of the path of a subject file, that file is not copied.
/z
Copies over a network in restartable mode.
See Also
Copy
Move
Dir
More Information About Xcopy
Xcopy--Notes
Xcopy--Examples