XCOPY

From Wikipedia, the free encyclopedia

XCOPY is a command dating from DOS operating systems, but is also available on Microsoft Windows. XCOPY, which stands for "external copy", is used for copying multiple files from one directory to another and for copying files across a network.

XCOPY's usage follows: XCOPY source [destination] [/A | /M] [/D:date [/P] [/S [/E] [/W] [/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U] [/K] [/N]

Contents

[edit] Command Options

[edit] DOS

  • /A Copies files with the archive attribute set, doesn't change the attribute.
  • /M Copies files with the archive attribute set, turns off the archive attribute.
  • /D:date Copies files changed on or after the specified date; if no date is specified, only files whose source time is newer than the destination time are copied.
  • /P Prompts the user before creating each destination file.
  • /S Copies directories and sub directories except for empty ones.
  • /E Copies directories and sub directories including empty ones. Same as /S /E. May be used to modify /T.
  • /V Verifies each new file.
  • /W Prompts the user to press a key before copying.

[edit] Windows 9x

Note: Windows 9x silently ignores the /V option.

  • /C Continues copying even if errors occur.
  • /I If destination does not exist and copying more than one file, assumes that destination must be a directory.
  • /Q Does not display file names while copying.
  • /F Displays full source and destination file names while copying.
  • /L Displays files that would be copied.
  • /H Copies hidden and system files also.
  • /R Overwrites read-only files.
  • /T Creates directory structure, but does not copy files. Does not include empty directories or sub directories. /T /E includes empty directories and sub directories.
  • /U Updates the files that already exist in destination.
  • /K Copies attributes. Normal xcopy will reset read-only attributes.
  • /Y Overwrites existing files without prompting.
  • /-Y Prompts the user before overwriting existing files.
  • /N Copy using the generated short names.

[edit] Windows NT 3.51

Note: Windows NT 3.51 does not recognise the /Y or /-Y options.

  • /N Copies using the generated short names.

[edit] Windows NT 4

  • /Z Copies networked files in restartable mode.

[edit] Windows 2000/XP/2003

  • /O Copies file ownership and ACL information.
  • /X Copies file audit settings (implies /O).

[edit] Examples

The following command can be used to copy an entire disk C:\ to another disk D:\:

xcopy C:\*.* D:\ /h /i /c /k /e /r /y

[edit] External links

In other languages