|< Day Day Up >|| |
Copies one or more files. XCOPY provides much more flexibility than does COPY.
Type COPY followed by general switches, then type the path of the file(s) to be copied followed by any switches that apply to the source files, then the path of the destination, if desired, followed by any switches that apply to the destination. The source can be a path to a drive, folder, or file. If it is a drive or folder, it will copy all the files in that folder to the destination, but it will not copy subfolders or any files within subfolders. Wildcards can be used in a source. Two or more files or folders can be specified in the source by using the plus sign (+) followed by a space character before each file after the first one listed, as in:
COPY /v D:\Backup\*.dll + D:\Backup\Example.txt C:\Windows\System32
This example would copy all .dll files in the Backup folder on the D drive, but no files in subfolders of Backup, plus the file Example.txt to the C:\Windows\System32 folder. The /v switch verifies that each file is copied properly.
The destination can also be a path to a drive, folder, or file. If the destination is a path to a drive or folder, the copy will keep the name of the original file. If the destination is a file with a name different from the original, the copy will have the new filename. If the destination is not specified, the copy will be placed in the current folder, as long as the current folder isn't the same as the source folder; in which case no copying will occur.
If two or more source files are specified but only one destination file is specified, the files will be combined into a single file, assuming the file formats are compatible with each other and can handle such a change. Text files (.txt), for example, can be combined.
/d: If any of the source files are encrypted, this switch removes the encryption attribute on the copies.
/n: Causes the filename to be converted to one that complies with the DOS 8.3 filename convention.
/v: Verifies that new files are copied correctly. It is advisable to use when copying critical files. It does cause the copying to take more time than without /v.
/y: By default, Windows prompts you to confirm that you want to overwrite an existing destination file of the same name in the same folder; /y stops these prompts.
/-y: Turns off the /y switch. Restores prompts to confirm that you want to overwrite an existing destination file of the same name in the same folder.
/z: In case copies are being made over a network and the network connection is lost, or one of the computers goes off line, /z sets the copy operation to automatically resume from where it left off after the connection is reestablished.
/a: Indicates an ASCII text file (see Windows' Help for more information).
/b: Indicates a binary file (see Windows' Help for more information).
You might have to surround folder names or filenames containing spaces with quotation marks, or use the 8.3 standard filenames when using this command.
|< Day Day Up >|| |