|
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]
[/y | /-y] [/z] Parameters source Specifies the location and names of the files you want to copy. This
parameter must include either a drive or a path. destination Specifies the destination of the files you want to copy. This parameter
can include a drive letter and colon, a directory name, a file name, or a
combination. /w Displays the following message and waits for your response before starting
to copy files:
/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 2000
operating system. The switch is accepted only for compatibility with previous
versions of /q Suppresses display of xcopy messages. /f Displays source and destination file names 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 hyphen (-)
as the separator rather than a forward slash (/) 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. The xcopy
command does 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, click attrib in the Related Topics list[JG1]. /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
wildcard 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. /y Suppresses prompting to confirm you want to overwrite an existing
destination file. The /y switch may be preset in the COPYCMD environment variable.
This may be overridden with /-y on the command line. The default is to
prompt on overwrites unless the copy command is being executed from
within a batch script. To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format). /-y Causes prompting to confirm you want to overwrite an existing destination
file. /z Copies over a network in restartable mode. If the connection is lost
during the copy phase (for example, if the server going offline severs the
connection), it will resume after the connection has been re-established.
Using this command switch also displays the percentage of the copy operation
completed for each file. |