XCOPY

RECENT NEWS

12/18/2015 - Hello! We're excited to announce that Mental Works Computing Software will soon be featuring

12/11/2015 - We're going to announce Dr.Batcher 3.0 Alpha with batch files debugger support soon. If you want to start...

News history...

TESTIMONIALS

Rob van der Woude:
"Mental Works Computing Software has created a nice tool for...

Andrew Jaritsyn:
“I used to write batch files with the help of Notepad, but...

Steve H.:
“This tool helped me to write some batch files in a couple...

More...

XCOPY

Copies files and folders, including subfolders.

Syntax:

XCOPY Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d [:MM-DD-YYYY]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a | /m}] [/n] [/o] [/x] [/exclude:FileName1[+[FileName2]][+[FileName3]] [{/y | /-y}] [/z] [/b] [/j]

Source – file(s) and folder(s) to be copied. Wildcards (*, ?) are allowed.

Destination – directory where the copied files will be placed.

/w – makes XCOPY wait for user presses a key before copying files.

/p – prompts before creating each destination file.

/c – ignores errors.

/q ‑ quiet mode: no messages.

/v – verifies copied files for identical data with the source ones.

/f – shows source and destination file names while copying.

/l – lists files to be copied.

/g – creates decrypted destination files if destination folder doesn’t support encryption.

/d [:MM-DD-YYYY] – copies files newer than the ones created at the specified date. MM – month, DD – day, YYYY – year. If you omit :MM-DD-YYYY parameter, XCOPY will copy files that are newer than existing destination files.

/u – copies only files that already exist in destination folder.

/i – creates destination directory if it doesn’t exist. Always assumes that destination is directory.

/s – copies non-empty subfolders.

/e – copies all subfolders, including empty ones.

/t – copies directory tree only (without files).

/k – keeps read-only attributes of the copied files (by default, this attribute is removed).

/r – overwrites read-only files.

/h – copies system and hidden files (by default, they are passed).

/a – copies only files with archive attribute without changing this attribute in any files.

/m ‑ copies only files with archive attribute and removes it for source files.

/n – uses short 8.3 file names for copied files, if possible.

/o – copies DACL information and ownership.

/x – copies file audit settings and SACL information (implies /o).

/exclude:FileName1[+[FileName2][+[FileName3](…)] – excludes files specified from copying queue.

/y – disables overwriting confirmation.

/-y – enables overwriting confirmation.

/z – restartable mode for network copying.

/b – copies symbolic links instead of files (Vista+).

/j – copies large files without buffering (Server 2008 R2+).

Usage:

/v option doesn’t make effect in XP+, it is added only for backward compatibility.

/n option is required when you copy files on old systems that require 8.3 file names.

/z option will not interrupt copying when you lose the connection.

XCOPY doesn’t let you copy encrypted files to drives that don’t support EFS.

You can append files by specifying single destination for different sources.

If you omit destination, XCOPY will copy everything to the current folder.

If you don’t add trailing backslash to destination, XCOPY will ask you whether it is file or folder. You can use /i option to suppress this prompt.

XCOPY accepts UNC pathnames.

XCOPY returns the following exit codes in ERRORLEVEL:

Examples:

Copy everything from one drive to another:

XCOPY c:\ d:\ /s /e /h

Copy everything from one drive to another except MP3s:

XCOPY c:\ d:\ /s /e /h /exclude:.MP3

 

Subscribe batch files programming newsletter (no spam):

Subscribe

Unsubscribe