|
XCOPY
Extends the COPY command. Copies files and directory trees.
Syntax
XCOPY source [destination] [options]
Key
source : Pathname for the file(s) to be copied.
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 of these.
[options] can be any combination of the following:
Source Options
/A Copies files with the archive attribute set
(default=Y)
/M Copies source files that have their archive
file attributes set.
/H Copies hidden and system files and folders
(default=N)
/D:mm-dd-yyyy
Copies source files changed on or after the
specified date only. If you do not include a
mm-dd-yyyy value, xcopy copies all Source
files that are newer than existing
Destination files. This command-line option
allows you to update files that have
changed.
/U Copies only files that already exist in
destination.
/S Copies directories and subdirectories,
unless they are empty. If you omit /s, xcopy
works within a single directory.
/E Copies folders and subfolders, including
Empty folders.
May be used to modify /T.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings.
Copy Options
/W Prompts you to press a key before starting
to copy.
/P Prompts you to confirm whether you want to
create each destination file.
/Y Suppresses prompting to confirm that you
want to overwrite an existing destination
file.
/-Y Prompts to confirm overwriting a file.
/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.
/C Continue copying even if an error occurs.
/I If in doubt always assume the destination is
a folder e.g. when the destination does not
exist.
/Z Copies over a network in restartable mode.
/Q Do not display file names while copying.
/F Displays source and destination file names
while copying.
/L List only - Display files that would be
copied.
Destination Options
/R Copies read-only files.
/T Create folder structure, but do not copy
files. Do not include empty folders or
subfolders.
/T /E will include empty folders and
subfolders.
/K Copies files and retains the read-only
attribute on destination files if present on
the source files. By default, xcopy removes
the read-only attribute.
/N If at all possible, use only a short
filename (8.3) when creating a destination
file. This may be nececcary when copying
between disks that are formatted differently
e.g NTFS and VFAT, or when archiving data to
an ISO9660 CDROM.
/O Copies file ownership and discretionary
access control list (DACL) information.
/X Copies file audit settings (implies /O).
XCOPY is similar to the COPY command except that it has
additional switches to specify both the source and
destination in detail.
Copying encrypted files to a volume that does not support
EFS results in an error. Decrypt the files first or copy the
files to a volume that does support EFS.
XCOPY is particularly useful when copying files from CDROM
to a hard drive, as it will automatically remove the
read-only attribute.
To append files, specify a single file for destination, but
multiple files for source (that is, by using wildcards or
file1+file2+file3 format).
Examples
To copy a file:
XCOPY C:\reports\MyFile D:\Backup\CopyFile
To copy a folder:
XCOPY C:\reports D:\Backup\ /i
To update files in the \Reports directory with the files in
the \Data directory that have changed since November 29,
2009:
xcopy \data \reports /d:11-29-2009
Cmd Commands
|