< Day Day Up > 

Copies files, folders, and subfolders. XCOPY offers great flexibility over any other way to copy, be it by command line or using the Windows graphical interface.


Type XCOPY followed by the path to the source file or folder, then the destination file or folder, and then any desired switches.


/w: Prompts you to press a key before copying commences.

/p: Prompts you to confirm that you want to create each destination file.

/c: Continues copying regardless of errors.

/q: Quiet mode. XCOPY messages are not displayed.

/f: Displays filenames while copying.

/l: Displays the names of all the files that are set to be copied.

/g: Specifies that destination files not be encrypted (2000 and XP only).

/d followed by a colon and the date in the mm-dd-yyyy format: Copies only those source files that had been modified on or after the specified date. If you do not include a date, all source files newer than the existing destination files of the same name are copied. The purpose of this command is to update files with newer versions. For example, to copy only .doc files newer than March 5, 2006 from a CD to a folder, you would type:

XCOPY D:\*.doc c:\folder /d:03-05-2006

/u: Copies only those source files with the same names as those already in the destination folder.

/i: If you have specified a folder or a file name with wildcards as the source and the destination folder doesn't already exist, /i causes XCOPY to create the new folder. The default is for XCOPY to prompt you to specify whether the destination is a folder or file.

/s: Copies folders and subfolders as long as there are files inside them.

/e: Copies all subfolders, regardless of whether there are files inside them.

/t: Copies the entire folder tree, but none of the files. Add the /e switch to copy empty folders.

/k: (2000 and XP) Causes the copied files to retain the read-only attribute if the source files had it. By default, copied files do not have the read-only attribute.

/k: (9x) Causes all attributes to be copied with the files.

/r: Copies files with the read-only attribute, but is not supposed to copy the attribute. However, it might actually copy the attribute in some cases.

/h: Copies files with hidden and system attributes. The default is for system and hidden files not to be copied.

/a: Copies only files with the archive attributes.

/m: Copies only files with the archive attributes, but removes the archive attribute from the source file.

/n: Applies 8.3 file and/or folder names to the copies. Necessary when copying files with long filenames to systems that can handle only 8.3 filenames. See Chapter 2 for more information.

/y: Normally, XCOPY prompts you to confirm that you want to overwrite a destination file of the same name as the one being copied; /y turns off this prompting.

/-y: Restores prompting to overwrite existing files of the same name as the one being copied.

/z: (2000 and XP only) If you are copying over a network and the network connection is lost for whatever reason, if you used /z, copying can pick up where it left off once the connection is restored; /z saves you from having to start over again; /z also displays the copying progress for each file.


  • If you attempt to copy encrypted files onto a drive that doesn't support the Encrypted File System (EFS), there will be an error and copying will not continue.

  • If you don't specify a destination, XCOPY uses the current folder.

  • By default, unless you use the /m switch, XCOPY's file copies all have the archive attribute set, regardless of whether it was set in the source files.

 < Day Day Up > 

PC Repair and Maintenance(c) A Practical Guide
PC Repair and Maintenance: A Practical Guide (Charles River Media Networking/Security)
ISBN: 1584502665
EAN: 2147483647
Year: 2004
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net