Sunteți pe pagina 1din 13

XXCOPY Command Parameters Reference.

pdf
Saved to Dropbox • May 12, 2019 at 12B34 AM

Home
What is XXCOPY ? [ Table of Contents ] [ Show as Detached ] [ >> ]
Products
Downloads XXCOPY TECHNICAL BULLETIN #001
FAQ
Order From: Kan Yabumoto tech@xxcopy.com
To: XXCOPY user
Support
Subject: XXCOPY Command Parameters Reference
About Us (Pixelab)
Date: 2010-01-01 Revised for ver 3.00.0
On-Line Manual ===============================================================================
XXTB #001
XXTB #002 Basic Command Parameter Syntax:
XXTB #003
XXCOPY source destination (simplified syntax)
XXTB #004
XXTB #005 In its simplest form, XXCOPY takes two parameters,
...
from WHERE to WHERE

This very intuitive command syntax has its root in the COPY command
introduced in 1981 as a PC-DOS (MS-DOS) built-in command.
XXCOPY

The first parameter is the source specifier and the second one is
Version
the destination specifier. These two parameters must be in this
3.33.3 order. As commonly done in the COPY and XCOPY command syntax, the
destination specifier can be omitted. Then, by default, the
current directory in the current drive becomes the destination.

Released XXCOPY source [ destination ]


2016-10-28
By convention, an optional parameter is denoted in the syntax
definition by a pair of square-brackets surrounding it.
©2016 Copyright
Pixelab In addition, you may add command switches (which are also called
options) to customize XXCOPY's behaviors. It is the extensive
set of switches that makes XXCOPY so versatile and powerful.
All rights reserved

Full Command Parameter Syntax:

XXCOPY source [ destination ] [ switches... ]

All switches start with a slash (/) character whereas the source
and the destination specifiers do not have the slash(/) prefix.
The source and the destination specifiers must be separated from
other items in the command line by at least one blank (space or tab)
character. On the other hand, you may omit blank characters between
switches in order to minimize the total length of the command line.

Example:

XXCOPY C:\mydir\ D:\yourdir\ /S /H

Here, "C:\mydir\" is the source specifier and "D:\yourdir\" is


the destination specifier. They do not start with a slash (/).
The command has two (/S and /H) switches.

Note that the positions of the switches need not be at the end of
the command line. Switches may begin even before the source specifier.
The order of the switches is not generally important with the exception
of when conflicting switches are specified, in which case the rightmost
switch will prevail. More rules for special cases are discussed at
the end of this article. For a complete review of syntax and semantics
for the source specifier, see XXTB #04.

-------------------------------------------------------------
Caution to DOS novices:

The blank characters (space or tab) act as the delimiter of


the arguments. Therefore, a name with an embedded space must be
surrounded by a pair of quotes (") that is to be kept unbroken.

XXCOPY C:\My Documents\ D:\backup\ // bad


XXCOPY "C:\My Documents\" D:\backup\ // good

This is true for nearly all command line applications.


-------------------------------------------------------------

Once you learn this simple rule, it is quite easy to understand a


long XXCOPY command line.
XXCOPY switches:

Here, a first time XXCOPY user may be overwhelmed by the sheer


number of switches. Since the power of XXCOPY arises from
these switches, you must learn to deal with them. We try our
best to keep these (still increasing) switches under our control.
Since the number of switches far exceeds the number of letters
available in the alphabet, many of the switches use multiple
characters. For better or worse, the syntax adheres to the
original XCOPY's syntax very closely. This is a mixed blessing,
for sure. So, when we felt very strongly about some problematic
cases, we took liberty of making improvements that do not adhere
to the original XCOPY syntax. But, such exceptions are very rare.
Overall, if you are very familiar with how XCOPY works, very little
will surprise you.

Let us take a look at the full list of XXCOPY switches; each switch
contains a terse comment. For most switches, full explanation will
be given later.

for Command Line Syntax XXTB #25


for Command Reference Alphabetic Listing XXTB #26
for Command Reference Functional Classification XXTB #27
for The Wild-Wildcard Source Specifier XXTB #28

----- The following switches use file attributes to select files -----

/A Same as /ATA. Copies only files with the archive attribute set.
Doesn't change the attribute.
/M Copies only files with the archive attribute set.
Turns off the archive attribute.
/AT<mask> Selects files by the attribute bits (ACHSR).
You may use two or more /AT<mask> switches to specify multiple
required attributes. E.g., /ATA/ATH qualifies files with both
the A(rchive) bit and the H(idden) bits.
Alternatively, you may use one /AT<mask> switch with multiple letters
to select alternative attribute bits to select files. E.g.,
/ATAH qualifies a file which has either A-bit, H-bit or both.
/AX<mask> Excludes files with the specified attribute bits (ACHSR).
You may use two or more /AX<mask> switches to specify
attribute bits to exclude files for file operations. E.g.,
/AXA/AXH excludes files with A-bit, H-bit, or both.
Or, you may use one /AX<mask> switch with multiple letters to
exclude files with only the specified combination of attribute
bits. E.g., /AXAH excludes files with both A-bit and H-bit.

Note: The /AT<mask> and /AX<mask> switches have opposite conjugation


rules (the effects of combining attribute bits --- AND and OR).

/A0 Cancels *ALL* /A, /M, /AT, and /AX switches.

----- The following switches modify the file attributes -----

/AA Sets the src file archive bit (without actually copying).
/AZ Clears the src file archive bit (without actually copying).
Note: Both /AA and /AZ implicitly set /H (can be overridden).
/AC Copies specified files irrespective of the archive attribute.
Turns off the archive attribute after XXCOPY is done.
/AN<mask> Sets a new value to file attribute bits (replace the value).
The <mask> value is a combination of letters, ACHSR.
/AR<mask> Resets file attribute bits (clears specified bits).
/AS<mask> Sets file attribute bits (sets specified bits).

Note: The <mask> value for /AR and /AS specifies attributes (ACHSR)
whose bits are either reset or set respectively to the existing
file attributes. Unspecified attributes bits are kept unchanged.

/ARD<mask> Resets directory attribute bits (clears specified bits).


/ASD<mask> Sets directory attribute bits (sets specified bits).

/ARD and /ASD work on directories analogous to /AR and /RS.

Note: The /AA, /AN, /AR, /AS, /ARD, /ASD, and /AZ switches modify the
file attributes without copying the files to the destination,
whereas the /A, /AT and /AX switches select files by the file
attributes for various operations (copy, list, remove, etc.).

----- The following switches use other file attribute bits -----

/H Copies hidden and/or system files also.


/H0 Excludes hidden and/or system files (default).
/Ho Copies hidden and/or system files only.
/R Overwrites read-only files.
/K0 Keeps H-bit and S-bit, sets A-bit, clears R-bit (default).
/K Keeps the source attributes including read-only (same as /KS).
/KS Keeps the source attributes including the read-only bit.
/KD Keeps the attributes of destination (overwritten) file.
/KN Sets the destination attributes to normal (only /A).
(File attributes are discussed in XXTB #06)

----- The following switches controls the compression on file copy -----

/KCFP Sets dst file's C-bit with that of its parent dir (default).";
/KCFD Keeps dst file's C-bit, a new file gets its parent's C-bit.";
/KCFS Sets dst file's C-bit with that of src file's C-bit.";
/KCFC Always sets the C-bit of dst file (compress).";
/KCFU Always resets the C-bit of dst file (uncompress).";

/KCDP Sets dst dir's C-bit with that of its parent dir (default).";
/KCDD Keeps dst dir's C-bit, a new dir gets its parent's C-bit.";
/KCDS Sets dst dir's C-bit with that of src dir's C-bit.";
/KCDC Always sets the C-bit of dst directory (compress).";
/KCDU Always resets the C-bit of dst directory (uncompress).";

Note: The /Kx switches affect only A, R, H, and S bits of files,";


whereas /KCFx and /KCDx affect only the C-bit of files and";
directories, respectively.";

----- The following switches are useful for backup and archive -----

/BI Backs up incrementally, different (by time/size) files only.


/BA Backs up incrementally (absolute) (more complete version of /BI)
/BB Backs up brand new files only (does not overwrite existing ones).
/BN Backs up newer files only (includes brand new files).
/Bo Backs up older files only (includes brand new files).
/BX Backs up different-date files (includes brand new files).
/BZ Same as /BZX.
/BZE Backs up equal-size files (includes brand new files).
/BZL Backs up larger-size files (includes brand new files).
/BZS Backs up smaller-size files (includes brand new files).
/BZX Backs up different-size files (includes brand new files).
/BE Backs up exactly the same files(includes brand new files).
/BS Selects exactly the same files (this is useful with /RS).
/BU Standard Backup switch (same as /KS/H/E/R/Q/Y/BI/ZE/oD0).
/B0 Undo any of /BI, /BB, /BN, /Bo, /BX, or /BZ switches.
/U Updates the files that already exist in destination.

Note: A "brand new" file refers to a file which exists in the


source directory but not in the destination directory
(Micrososoft's Robocopy call it a "lonely file").

/CD0 Does not compare file data byte-by-byte (default).


/CDM Selects files whose data match in byte-by-byte comparison.
/CDU Selects files whose data unmatch and brand new files.
/CDX selects files whose data match byte-by-byte and brand new files.

/SP Spans the copy job over multiple destination (new volume).

Note: /SP cannot be used with switches which reference the


destination for file selection --- that is, the /Bxx
(backup) switches, and /U will be disabled by /SP.
That is, the spanning of the destination volume by /SP
assumes the backup operation is a full backup without
referencing the files already on the destination.

----- The following switches are shortcuts for popular operations -----

/BU Shortcut for /KS/H/E/R/Q/Y/BI/ZE/oD0. Good for common directory backup


/BACKUP Shortcut for /KS/H/E/R/Q/Y/BI/ZE/oD0. Good for common directory backup
/CLONE Shortcut for /KS/H/E/R/Q/Y/BI/ZE/oD0/ZY. Good for common directory cloning

Note: Both the /BACKUP and /CLONE operations copy the contents of the
source directory into the destination directory incrementally
(only those files with the timestamp and/or the filesize changed).
The /CLONE operation differs from the /BACKUP operation by deleting
extra files and directories in the destination directory (whose
counterpart in the source no longer exists). This makes /CLONE
considerably more dangerous than /BACKUP.

----- The following switch adds inclusive alternate templates -----

/IN<tmpl> Includes an alternate filename template (tmpl).

You may specify as many alternate filename patterns as you wish.


The template must be for the "Lastname" of the source specifier
(no backslash in the template, but wildcard characters are OK).

----- The following switches exclude directories or files -----

/X<xspec> Adds an exclusion specifier (xspec) (see below for exclusion).


/EX<xlist> Specifies a text file which contains a list of xspecs (see below).

<xspec> Exclusion item for /X and the file contents specified by /EX.
. The text file may contain an arbitrary number of xspecs which
are separated by space, tab, or newline characters.
. An xspec with embedded spaces must be surrounded by a pair
of double-quote characters(").
. An xspec cannot span from one line to another.
. Two consecutive colons (::) or slashes (//) start a comment
field which ends at the end of the line.
. You may specify more than 1 exclusion file. In such a
case all of the exclusion files will be processed.

Exclusion specifier (xspec) syntax:

. You may use any number of wildcard characters (* or ?) anywhere


in an exclusion specifier (Wild-Wildcard).
. An xspec for directories must be followed by a backslash.
. An xspec not followed by a backslash is for files.
. To use the old syntax for directory_template\?\*, you must
the /GX switch. In lieu of the obsolete syntax, it is advised
that the regular syntax (directorY_template\?*\*) be used.
. A bare file template applies to all directories.
E.g., *.mp3 is treated as *\*.mp3 (*\ is implicitly assumed).

XXCOPY optimizes the exclusion parameter by eliminating


some redundant specifiers.
Use "/W/oX" with xspec to test the syntax.

/ZLX0 Disables exclusion testing (default).


/ZLX Enables exclusion test (displays only excluded objects).

Note: /ZLX performs a 'dry-run' (like /L) without copying files.

/GX Accepts the obsolete ending (...\?\*) in the exclusion item


/GX0 Disables the obsolete syntax in exclusion item.

See XXTB #05 (The Exclusion specifier).

----- The following switches limit files by the filetime -----

/D Same as /DA.
/DA Copies newer files and brand new files.
/DB Copies older files and brand new files.
/DS Copies only the files whose filetime is exactly the same.
/DX Copies only the files whose filetime is different in any way.

Note: All filetime comparisons are affected by the fuzzy range (/FF).

/D:<date> Same as /DA:<date>.


/DA:<date> Copies files that were changed on or after the specified date.
/DB:<date> Copies files that were changed on or before the specified date.
/Do:<date> Copies files that were changed on the specified date.
/DA#<n> Copies files that were changed on or after <n> days ago.
/DB#<n> Copies files that were changed on or before <n> days ago.
/Do#<n> Copies files that were changed on the day <n> days ago.

Note: A "brand new" file refers to a file which exists in the


source directory but not in the destination directory
(Micrososoft's Robocopy call it a "lonely file").

Note: With /DA#<val>, /DB#<val> and /Do#<val>, the parameter <val> will
be treated as the number of Days unless it is appended with a
one-letter suffix (D, H, M, or S which stand for Days, Hours,
Minutes, or Seconds, respectively). When <val> is given in
the number of days, the exact time is midnight of the day.

e.g., /DA#0 denotes files made some time today after midnight.
/Do#2 means all day the day before yesterday.
/DA#30m selects files made within the last 30 minutes.

/DA:. Copies files that were changed today or later (same as /DA#0).
/DB:. Copies files that were changed yesterday or earlier.
/Do:. Copies files that were changed today only.

/DA:<val> and /DB:<val> work as a pair if both are specified.

e.g., /DA:1997-01-01 /DB:1997-12-31 files made in 1997


/DA:1997-04-01 /DB:1997-04-30 files made in April 1997
/DB:1997-03-31 /DA:1997-05-01 exclude files made in April
/DA:1997-01-01 /DB:1997-01-01 try the shorter /Do:1997-01-01

Since the US and European conventions are not reconcilable,


we recommend that you use the ISO 8601 standard (YYYY-MM-DD) with
a 4-digit year value followed by month and day. If all values have
2 digits only, it is interpreted according to the system setting.
A file date must be between 1970-01-01 and 2069-12-31.

A partial date specifier is accepted for /DA:, /DB: and /Do:


where yyyy-mm and yyyy denote the month and year respectively.
E.g., /Do:2000-2 is equivalent to /DA:2000-2-1 /DB:2000-2-29,
and /DB:1999 to /DB:1999-12-31, and /DA:2000 to /DA:2000-1-1.
/DA:<time> Same as /DA:<date> except an additional time value may be added.
/DB:<time> Same as /DB:<date> except an additional time value may be added.

The <time> parameter starts with the <date> (as shown above)
followed by 'T' or '@' and hh:mm:ss, hh:mm, or hh.

e.g., 2002-10-25T15:25:30 (recommended as ISO 8601 std)


31-10-2002@13:00 10-31-2002@13 (min and sec may be omitted)
(/D0:<date> cannot be specified with the <time> value).

Note: /DA, /DB, /DX, /DS, /Do, /DA:<date> and /DB:<date> are mutually
exclusive (except /DA:<date> and /DB:<date> work as a pair).

Note: /DA and /DB, if date is omitted, are the same as /BN and /Bo,
respectively, except that /DA and /DB can be combined with another
/Bxx switch (e.g., /BI) where as /BN and /Bo cannot (in the same group).

Note: /DA, /DB, /DX and /DS compare source and destination files using
both date and time whereas /DA:<date> and /DA#<n> use date only.

/D0 Cancels all file-date related (/D...) switches.

----- The following switches modify filetime semantics -----

/FW Uses the Last-Write timestamp for the Filetime comparison (default).
/FA Uses the Last-Access timestamp for the Filetime comparison.
/FC Uses the Creation timestamp for the Filetime comparison.

Note: /FW, /FA and /FC are mutually exclusive choices.

/FL Filetime in Local time (default).


/FU Filetime in UTC(Universal Coordinated Time - same as GMT).

Note: /FL and /FU are mutually exclusive choices.

Note: The word "Filetime" (or sometimes, "Filedate") is used


in the context of comparing the time value associated
with a file against another time value (e.g., in /DA, /BN)
and XXCOPY uses only one of the three timestamps that
are attached to a file (by the /FW, /FA or /FC switch).

/FF Fuzzy Filetime (same as /FF2S --- matches within 2 sec).


/FF0 Fuzzy Filetime cancelled (adjustment value set to +/- 0).
/FF<val> Fuzzy Filetime, adjust ref time +/- <val> seconds.
/FF+<val> Fuzzy Filetime, adjust ref time by adding <val> seconds.
/FF-<val> Fuzzy Filetime, adjust ref time by subtracting <val> seconds.

Note: With /FF<val>, /FF+<val> and /FF-<val>, the parameter <val> will
be treated as the number of seconds unless it is appended with a
one-letter suffix (D, H, M, or S which stand for Days Hours,
Minutes, or Seconds, respectively).

e.g., /FF treats file times within +/- 2 sec as the same.
/FF-1H treats files older by up to 1 hour as the same.
/FF+2/FF-4 (you may choose asymmetric slack values).

Note: The /FF switch affects all filetime comparisons such as /CLONE,
/BI, /BU, /BS, /BX, /BO, /BN, /DA, /DB, /DS, /DX, /TS, and /TD.

Note: The FAT (DOS/Win9x) file system has a 2-second granularity in


file time whereas NTFS, Unix and other file systems use finer
time stamps. The /FF switch is useful for incremental backup
between volumes of different file systems.

----- The following switches cope with time zones -----

/TS+<n> Adds an offset (Hr) to the time of source (and the copied ) file.
/TS-<n> Subtracts an offset (Hr) from source (and the copied) file.
/TD+<n> Adds an offset (Hr) to the time of the destination file.
/TD-<n> Subtracts an offset (Hr) from the dst file for comparison.

Note: The offset value <n> for /TS and /TD is specified in hours
unless it is appended with a one-letter suffix (D, H, M, or S
which stand for Days, Hours, Minutes, or Seconds respectively).

----- The following switches control timestamps -----

/TTA Touches (modifies) timestamp of Last Access of src.


/TTA0 Preserves timestamp of Last Access of src (default).

/TCA Copies the timestamp of Last Access fm src to dst.


/TCA0 Uses current time for dst Last Access (default).

/TCC Copies the timestamp of Create Time fm src to dst.


/TCC0 Uses current time for dst Create time (default).

/TCW Copies the Last Write time fm src to dst (default).


/TCW0 Uses current time for dst Last Write time.

/TC Shortcut for /TCA/TCC/TCW (copies all three types of timestamps)


/TC0 Shortcut for /TCA0/TCC0/TCW0.
----- The following switches qualify the source by file size -----

/SZ:<n>-<m> Copies a file whose size is between n bytes and m bytes.


/SZ:<n>- Copies a file whose size is equal to or greater than n bytes.
/SZ:-<m> Copies a file whose size is equal to or less than m bytes.
/SZ:<n> Copies a file whose size is exactly n bytes.
/SZ!<n>-<m> Copies a file whose size is NOT between n bytes and m bytes.
/SZ!<n>- Copies a file whose size is NOT equal to or greater than n bytes.
/SZ!-<m> Copies a file whose size is NOT equal to or less than m bytes.
/SZ!<n> Copies a file whose size is NOT equal to n bytes.
/SZ:- Disables size-based selection (/SZ!- also works).

Note: The size values <n> and <m> are entered in bytes unless appended
with a suffix letter (K, M, or G which stands for metric kilo
(x1000), mega (x1000000), or giga (x1000000000) respectively).

----- The following switch limits the destination file size -----

/TR<n> Truncates the new file to (copies the first) n bytes.

----- The following switches deal with subdirectories -----

/S Copies directories and subdirectories except empty ones.


/E Copies directories and subdirectories, including empty ones.
Same as /S /E.
/T Creates directory structure, but does not copy files. It copies
all directories including empty ones (implicitly sets /E).

/SG Same as /SGN (see variations in handling duplicates below).


/SGF Gathers files into one-level directory (unsorted First file 1st).
/SGL Gathers files into one-level directory (unsorted Last file 1st).
/SGN Gathers files into one-level directory (sorted, Newest file 1st).
/SGo Gathers files into one-level directory (sorted, Oldest file 1st).
/SGFo Gathers files into one-level directory (First only).
/SGLo Gathers files into one-level directory (Last only).
/SGNo Gathers files into one-level directory (Newest only).
/SGoo Gathers files into one-level directory (Oldest only).
/SG0 Cancels file-gather switches (/SG...).

Note: /SGL and /SGLo is works well with other file-selection switches.
E.g., /SGLo /BZL to gather the largest file of its kind.

/SL Flattens subdirectories, add-name-Left (see below).


/SX Flattens subdirectories, add-name-Middle (see below).
/SR Flattens subdirectories, add-name-Right (see below).

/SL, /SX, and /SR are the same as /S except the output files
will be saved as a flat directory without adding levels of
subdirectories. The source subdirectory name will become a
part of the target filename. /SL and /SR add the subdir name
to the left or right of the name respectively.
/SX inserts the subdirectory name in the middle.

/SLR Rebuilds flattened directory (path to the left).


/SXR Rebuilds flattened directory (path in the middle).
/SRR Rebuilds flattened directory (path to the right).

/SLR /SXR, and /SRR do opposite of /SL, /SX and /SR respectively.

/S<d> Sets the directory delimiter character for /SL, /SX and /SR,
where <d> is any legal non-alphabetic, non-blank character.
The default delimiter is back-apostrophe (`).

/DL<n> Limits processing of directory nesting to n levels.


/DL0 removes the limit. /DL works only when /S or /E is set.

----- The following switches controls the maximum path length -----

/VL Enables the Very Long Path (same as /VL32767).


/VL<n> Sets the maximum path length to n chars (up to 32767).
/VL0 Disables the Very Long Path (default with 259 chars).

----- The following switches check the destination directory -----

/I If the destination does not exist and you are copying more
than one file, this switch assumes that the destination must
be a directory (no prompting).
Note: when the destination specifier ends with a backslash, it
declares itself as a directory which implicitly sets the /I switch.
/IA Continues if destination is absent (terminates if it exists).
/IA<item> Continues if the specified item (file/directory) is absent.
/IP Continues if destination is present (terminates if absent).
/IP<item> Continues if the specified item (file/directory) is present.
/ILD<label> Continues if the destination volume label matches as specified.
/ILS<label> Continues if the source volume label matches as specified.

/Z Deletes extra files or subdirectories in destination.


/ZY Same as /Z except there is no confirmation prompt.
----- The following switches control the file copy buffer size -----

/ZB<n> Sets the size of the file copy buffer (in bytes).
/ZB0 Cancels the buffer size setting (uses the default size).

----- The following switches are for safe file overwrite -----

/So Enables Standard Safe File Overwrite (Same as /So1).


/So0 Disables Safe File Overwrite.
/So1 Enables Standard Safe File Overwrite (default).
/So2 Enables Very Safe File Overwrite (always via temporary file).

----- The following switches controls file versioning -----

/JV Archives existing dst file with a versioning number (9999).


/JV<n> Archives existing dst file up to up to n versions.
/JV0 Disables versioning by simply overwriting the existing file

----- The following switches control the prompting behaviors -----

/P Prompts you before creating each destination file.


/PC Prompts you before creating new files.
/PC0 Suppresses warning on file-creation.
/PD Prompts you before processing each directory.
/PD0 Suppresses prompts before processing each directory.
/PJ Prompts before a different type dst is overwritten (default).
/PJ0 Suppresses the warning for trans-overwrite (different type).
/PM Prompts before deleting existing file at the move destination.
/PM0 Suppresses prompts on deleting existing file at move destination.
/PN Prompts when on excessive failures on /NX operations.
/PN0 Suppresses prompts on excessive failures of /NX operatoins.
/Po Prompts you before overwriting existing files (default).
/Po0 Suppresses warning on file-overwrite (Legacy /Y).
/PP Enables the space bar press-for-pause feature (default).
/PP0 Disables the space bar press-for-pause feature.
/PR Prompts on removing a file whose path contains reparse pt (default).
/PR0 Does not prompt before removing a filw with reparse point path.
/PW Enables Prompt with Dialog Window.
/PW0 Disables Prompt with Dialog Window (default).
/PZ Prompts you for confirmation of the dst (for /CLONE /Z /ZY).
/PZ0 Suppresses the prompt for directory confirmation on /CLONE /Z /ZY.

/W Same as /WS.
/WS Prompts you to press a key at the start of copying.
/WS<n> Waits at the start of operation for a specified period (n sec).
/WE Prompts you to press a key at the end of copying.
/WE<n> Waits at the end of the operation for a specified period (n sec).
/WD0 Suppresses warning for copying a non-directory source.
/WD Prompts with a warning for copying a non-directory src (default).
/WL Issues a warning when the path length exceeds the limit (default).
/WL0 Suppresses warning for the path length exceeds the limit.
/WN Displays a warning on failure on SFN-preservation in file copy.
/WN0 Suppresses warning on failure on SFN-preservation in file copy.
/WU<n> Prompts with a warning for unneccary destination (default).
/WU0<n> Suppresses warning for unnecessary destination specifier.
/WV0 This switch is now obsolete and has no effect.
/WV This switch is now obsolete and has no effect.

/C Continues copying even if errors occur (default).


/C0 Disables the /C switch (terminates upon error).
/CB Continues batch file if XXCOPY ended OK last time.
/CBQ Same as /CB except suppresses console output to end immediately.
/CB0 Cancels the /CB and /CBQ switches.
/CE Same as /CBQ/EC (most useful in batch file with @echo off).
/CR<n> Sets the retry period (n seconds, default = 3) on failed copy.

/Y Overwrites existing files without prompting (See /BB).


/-Y Prompts you before overwriting existing files.
/Y0 Same as above (/-Y).
/YY Suppresses ALL prompts unconditionally (good in a batch script).

----- The following switches control Remove (file delete) -----

/RC Removes files in src after a successful copy (equivalent to move)


/RS Removes files in src which qualify (no copying).
/RD Removes files in dst which qualify to be overwritten (no copying)
/RX Removes files in dst which are absent in src (no copying).
/R0 Undo any of /RC, /RS, RD, or /RX switches.
/RCP Prompts on source-file-remove after successful copy (default).
/RCY Suppresses prompts after a successful source-file-remove.

Note: Whereas /Y and /-Y modify prompting for the copy action
of /RC (Remove after Copy) switch, the suffix 'P' or 'Y' controls
the prompt for the file remove action after copy.

Note: The suffix 'P' or 'Y' can also be added to any of /RS, /RD,
or /RX switches which will insert or suppress respective prompt.
For these remove-without-copy switches, the /Y and /-Y switches
also control the prompt for the remove action.
Note: /RX can be thought of a /Z operation without copying files.";
In general, the /RS/BB combination (by swapping src and dst)";
provides more file-selection controls than the /RX switch.";

Note: /PD and /PD0 control additional prompt on each directory.

/RMDIR Removes a directory Same as /RS/S/H/R/PD0/ED0.

----- The following switches control Move operations -----

/MVD Moves directories (the src and dst must be in the same volume).
/MVF Moves files (the src and dst must be in the same volume).
/MVX Moves files, if fails then tries /RC (remove-after-copy).

----- The following switches control empty directories -----

/ED0 Deletes an empty directory (default)


/ED Preserves the directory even if it becomes empty.
/ED<n> Preserves n levels of empty directories.

Note: These switches are in effect only with file/directory removal


operations (/Z, /RC, /RS, /RD, /RX, and /CLONE cases).

----- The following switches control cyclic directory copy -----

/CC0 Disallows cyclic copy (src includes the dst directory).


/CC Warns a cyclic copy with a Y/N prompt.
/CCY Allows a cyclic copy by excluding the dst from src (default).

----- Filename pattern matching -----

/N Uses the short (8.3) name for name matching, and creation.
/N0 Disables /N and /NP (default, uses longname when applicable).
/NP Uses precise name matching (default, ignores match in alias).
/NP0 Uses loose name matching (longname or shortname match).
/NX Preserves the shortname when the file is copied.
/NX0 Disables the /NX (shortname preservation) feature.

Note: /N, /NP, and /N0 are mutually exclusive.

Note: If src and dst are both local drive, the shortname will be
preserved (/NX) by default, but if either src or dst is
specified by a UNC (starts with \\), /NX0 is default.

/NL Renames longname to match the source (No copy operations).


/NS Renames shortname to match the source (No copy operations).
/NC0 Disables /NCL, /NCU, or /NCX (accepts letters of both cases).
/NCU Uses Uppercase-only name when a new file is created.
/NCL Uses Lowercase-only name when a new file is created.
/NCX Uses Uppercase-only name when a new short-name file is created.
/NW Uses the new (Win32) wildcard matching scheme.
/ND Uses the old (DOS) wildcard matching scheme.

Note: /ND and /NW are mutually exclusive choices.

----- The following switches terminate when a quota is met ----

/QF Quits when the quota for the file count has been reached.
/QBL Quits before the byte count exceeds the limit (same as /QB).
/QBT Quits when the total byte count reaches the trigger point.
/QSL Quits before the space dips below the limit (same as /QS).
/QST Quits when the remaining space reaches the trigger point.

----- Miscellaneous switches -----

/NI Becomes nice to other tasks by idling (1000 msec) between actions.
/NI<n> Same as /NI. Specifies n msec as the idle time (0 to disable it).

/CF<fname> Specifies a Command File whose contents are treated as if


they were entered at the position it appear in the command line.
The Command File is a text file which may have multple lines.
// Starts a comment field. The rest of the line will be ignored.
:: Starts a comment field. The rest of the line will be ignored.

(See XXTB #37 for a full coverage of this feature.)

/V Verifies after copy default (same as /V1).


/V1 Verifies after copy (quick test --- file size match).
/V2 Verifies after copy byte-by-byte check (DATMAN 2-pass).
/V0 Disables verify switch (canceling /V, /V1, or /V2).
/ER Emulates XCOPY's exit code (for ERRORLEVEL check in batch files).

/CLONE Duplicates a directory (volume). This switch is a shortcut of


the following combination: /KS/H/E/R/Q/Y/BI/ZY/ZE/oD0.

/CK Checks remaining space before copy (default).


/CK0 Disables the pre-check of remaining space before copy.

----- The following switches control the progress bars -----


/PB Shows Progress bar for the job (default file progress >= 1M).
/PB<n> Shows Progress bar for the job and another Progress bar for a
single-file progress with file length greater than <n>, which is
specified in bytes (or with a suffix, K, M or G) (default: 1M).
/PBH Enables Progress bar Halt/Abort button (default).
/PBH0 Disables Progress bar Halt/Abort button.

----- The following switches control List output -----

/L Same as /LLZ which performs the list operation (no file copy).
/L<items> Customizes the format for List operation (no file copy).
<items> is a string of one or more of the following letters
which selects the combination and the output order.

D file date
T file time
H history (creation, last-write, last-access timestamps)
Z file size in bytes
A file attributes: A(rchive),H(idden),S(system),R(eadonly)
S short name (8.3)
N long name (lastname) without path
L long name with full directory path
P parent path name without the lastname
R long relative (below base directory) name
, comma as a separator (for a CSV format output)

Note: When S and L are both missing, L is used by default.

Note: The format specified by /FM<items> will be used


for /L output if /L is present without its own parameter.

/LTREE Lists directory tree (without copy or making directories).

Note: with /LTREE, the /DA/DB/Do parameters apply on dir time.

/F Displays full source and destination file names while copying.


/Fo<fname> Displays full source and file names and also saves into a file.
/FM0 Cancels the /FM<items> parameter previously set.
/FM<items> Specifies the output line format for /L and or /Fo output.

<items> is a string of one or more of the following letters


which selects the combination and the output order.

D file date
T file time
H history (creation, last-write, last-access timestamps)
Z file size in bytes
A file attributes: A(rchive),H(idden),S(system),R(eadonly)
S short name (8.3)
N long name (lastname) without path
L long name with full directory path
P parent path name without the lastname
R long relative (below base directory) name
, comma as a separator (for a CSV format output)

Note: When S and L are both missing, L is used by default.

Note: /L/FM<items> can be combined into a /L<items> switch.

----- Miscellaneous switches -----

/MD<dir> Makes directory before other actions (even with /L).

Tip: make a date-encoded directory with a macro reference.


e.g., /MDc:\Bkup/$DATE$ (even good for log files).

----- The following switches control Security Information -----

/SC Same as /SC3 (copies security info).


/SC0 Cancels the /SC or /SF switch (no security info copied).
/SC1 Copies security info (Permissions only) when a file is copied.
/SC2 Copies security info (Auditing only) when a file is copied.
/SC3 Copies security info (both Perm, Audit) when a file is copied.
/SF Same as /SF3 (fixes up security info)
/SF0 Cancels the /SC or /SF switch (equivalent to /SC0).
/SF1 Fixes up security info (Permissions only) (no file copy).
/SF2 Fixes up security info (Auditing only) (no file copy).
/SF3 Fixes up security info (both Perm, Audit) (no file copy).

Note: /SC and /SF work only when src and dst are both NTFS.

----- The following switches control file sharing -----

/SHR Enables file-sharing for read-only with other programs (default).


/SHW Enables file-sharing for write-only with other programs.
/SHRW Enables file-sharing for rd/wr with other programs (same as /SH).
/SH0 Disables any sharing (Exclusive file access only).

----- The following switches control junctions and symbolic links -----

/JS Treats file symbolic links as symblic links (default).


/JS0 Treats file symbolic links as regular files.
/JH Treats file hard links as hard links (default).
/JH0 Treats file hard links as regular files.

/JL Treats directory symbolic links as symblic links (default).


/JL0 Treats directory symbolic links as regular directories.

/JP Treats junction (non-mount) points as junction pts (default).


/JP0 Treats junction (non-mount) points as regular directories.

/JM Treats volume mount points as volume mount points(default).


/JM0 Treats volume mount points as regular directories.

/JJ Shortcut for /JL/JM/JP/JS/JH (default).


/JJ0 Shortcut for /JL0/JM0/JP0/JS0/JH0.

/JR Shortcut for /JL/JM/JP/JS.


/JR0 Shortcut for /JL0/JM0/JP0/JS0.

/JX<mask> Excludes the specified J-thingies from normal processing.


Note: The <mask> specifies one or more J-thingies (FSHDLMP).
/JX0 Processes all J-thingies without being excluded (default).
/JXJ Same as /JXLMPSH (excludes all J-thingies including HLNK).
/JXR Same as /JXLMPS (excludes all reparse points (not HLNK)).

/JI<mask> Includes the specified J-thingies (inverse switch of /JX).


Note: The <mask> specifies one or more J-thingies (FSHLMP).
E.g., /JIM is equivalent to /JXFHLPS (D is not excluded).
/JIJ Same as /JXF (selects <LNK>,<JCT>,<MNT>,[SYM] and [HLK]).
/JIR Same as /JXFH (selects <LNK>,<JCT>,<MNT> and [SYM]).

/PJ Prompts before a different type dst is overwritten (default).


/PJ0 Suppresses the warning for trans-overwrite (different type).

/PR Prompts on removing a file whose path contains reparse pt (default).


/PR0 Does not prompt before removing a filw with reparse point path.

/WR Warns if src or dst specifier contains a reparse point (default).


/WR0 Suppresses warning for src or dst specifier with a reparse point.

/JCYCLIC Shows cyclic links (<LNK><JCN><MNT>) in the src directory.

----- The following switches control hard links and symbolic links -----

/MLH Makes a hard link file in dst for each file in the src.
/ULH Unlinks hard link files into regular (non hard link) files.

----- The following switches control file-write cache -----

/CA Enables all cache. Same as /CA7 (default).


/CA0 Cache control: src-rd = OFF dst-wr = OFF dst-rd = OFF
/CA1 Cache control: src-rd = OFF dst-wr = OFF dst-rd = ON
/CA2 Cache control: src-rd = OFF dst-wr = ON dst-rd = OFF
/CA3 Cache control: src-rd = OFF dst-wr = ON dst-rd = ON
/CA4 Cache control: src-rd = ON dst-wr = OFF dst-rd = OFF
/CA5 Cache control: src-rd = ON dst-wr = OFF dst-rd = ON
/CA6 Cache control: src-rd = ON dst-wr = ON dst-rd = OFF
/CA7 Cache control: src-rd = ON dst-wr = ON dst-rd = ON

----- The following switches control the console output -----

/EC Echoes the entire command line (after macro processing).


/Q0 Displays all file names.
/Q Same as /Q1. Does not display files which are skipped.
/Q1 Does not display files which are skipped.
/Q2 Does not display directories which are excluded.
/Q3 Does not display file and directory names while copying.
/WI<n> Sets the output line width to n columns (default:auto).
/ZS Disables the sign-on message and statistics output.

----- The following switches control the log output -----

/oA<fname> Appends to a logfile, reporting errors. (does not overwrite log).


/oN<fname> Outputs a new logfile, reporting errors (make a new log) file.
/o0 Cancels the /oN or /oA switch specified earlier.
/oQ Surrounds pathname output with quotation marks.
/oQ0 Disable quotation marks that surround pathname.
/oR Displays the target path of reparse point.
/oR0 No display of the target path of reparse point.

The screen and the log file output can be fine tuned by the followng:

/oB<n> Brief switch (both specified and default) list.


/oC<n> Displays links (<LNK><JCT><MNT>) that are cyclically referenced.
/oD<n> Deleted-file list (by a /Z or /ZY switch).
/oE<n> Error summary with the system error code
/oF<n> File list (files which were successfully operated on).
/oH<n> Displays the list of hard link(s) to the selected file if linked.
/oI<n> Include-item (alternate file template) list.
/oP<n> Parameter (command switch detailed) list.
/oS<n> Skipped-file list (with the reason why skipped).
/oX<n> Exclude-item list.
The suffix value <n> for /oB/oD/oE/oF/oH/oI/oP/oS/oX works as follows:

0: No output
1: Screen only
2: Log file only
3: Screen and Log file both

Note: It is advised that the log file created by /oA or /oN to be


free from the names of successfully copied files that would
overshadow relatively infrequent lines of error and warning.
Instead, use the /Fo switch to create a separate file for a
list of successfully copied files.

/UT Encodes output file(s) in UTF-8 text.


/UT0 Encodes output file(s) in ANSI text (default).

/DEBUG Shows the command parameters and prompts you to start.


/DEBUGX Shows the command parameters and exits.
/HELP Shows the switches in detail (print this output).
/HELP /X Shows Partial Help (switches starting with letter X).
/HELPA Shows the /HELP listing in alphabetical order.
/HELPE Lists the Exit codes (ERRORLEVEL values) returned by XXCOPY.
/? Shows a summary of the switches on one page.
... /? Shows related switches when entered with other switches.

Note: All XXCOPY command switches are case-insensitive.


The alphabet, O, is spelled in lower-case (o) in this page to
help distinguish it from the numeric zero (0).

Note: Virtually all of the switches can be disabled by adding 0 (zero)


at the end (e.g., /A and /A0). Due to the space limitation and
their redundant nature, only some of these cases are listed in
the help text.

----- Pre-defined macros to embed current date and time ----

/$xxxx$ Pre-defined macros for current date and time which may appear
anywhere in the command argument and other XXCOPY parameters.
Examples below are for the current time, Dec 25, 2002 13:15:30
/$DATE$ Expands to month and date (equivalent to /$MMDD$) --> "1225".
/$TIME$ Expands to hour and minutes (equiv. /$HHNN$) --> "1315".
/$YYMMDD$ Expands to 2-digit year month day --> "021225".
/$YYYY-MM$ Expands to 4-digit year month --> "2002-12".
/$YY-M-D$ Expands to 2-digityear-mo-dy (mo and dy without leading zero).
/$HHNNSS$ Expands to hour minutes second --> "131530".
/$MON-DD$ Expands to month day --> "DEC-25".
/$WWW$ Expands to day of the week --> "WED".
/$W$ Expands to ordinal number of day of the week --> "3".
/$II-IWK-K$ Expands to the ISO 8601 year-week --> "02-W52-3".
/$HOSTS$ Expands to the name of the host (curren) computer.

/TM0 Cancels the time offset set by /TM+ or /TM-.


/TM+<n> Adds an offset to the current time of macro reference.
/TM-<n> Subtracts an offset to the current time of macro reference.

Note: The offset value <n> for /TM+ and /TM- is specified in days
unless it is appended with a one-letter suffix (D, H, M, or S
which stand for Days, Hours, Minutes, or Seconds respectively).

----- Environment Variables in XXCOPY command files ----

/%xxxx% Environment variable (E-Var) reference in command files


(/CF and /EX). Like the macro reference counterpart,
the string value which correspoinds to an E-Var can be
brought in the command line text using the /%xxxx% syntax.
Note that this syntax should be used only inside the
external file text for XXCOPY (/CF and /EX) which cannot
be processed by the OS's command processor. That is, in
the regular command line, the E-Var reference is already
supported (without a leading slash as the prefix).

----- Installation of XXCOPY ----

/INSTALL Installs the XXCOPY software package on your computer.


/INSTALL:<dir> Installs XXCOPY at user-specified directory.
/SKIPIC Skips the creation of XXCOPY Desktop Icon with /INSTALL.
/SKIPXC Skips the installation of the XXConsole with/INSTALL.
/UNINSTALL Uninstalls XXCOPY from your computer.
/LICENSE Displays the XXCOPY license status on your computer.
/HOSTS Displays the names of remote hosts accessed by XXCOPY.
/ADDHOST:<id> Add a new computer name in the host list.

----- Miscellaneous commands ----

/NoP Performs no file operations (good for /MD, /oN, etc.).


/WHICHX Itendifies which XXCOPY.EXE file is launched (no action).

----- Environment variables that affect XXCOPY-----


COPYCMD Specifies file-overwrite prompting.
/Y suppresses the prompt (always overwrite)
/-y prompts you for a Yes/No/All option for a file overwrite
(This feature is for the COPY/XCOPY compatibility.)
XXCOPY Specifies XXCOPY's command argument. This argument string
is evaluated first and therefore the user-typed command line
can override it. The syntax is the same as regular argument.
XXCOPYX Specifies a list of exclusion specifiers (xspec).
Do not use switch prefix (/X). See the /X switch for details.

/ZE Disables the use of all Environment Variables for XXCOPY.


/ZX Disables the use of the Environment Variable XXCOPYX.
/ZX0 Enables the XXCOPYX settings. Good for /CLONE and /RMDIR.

The shortcut /CLONE and /RMDIR contain /ZE as a component.


e.g., /CLONE/ZX0 allows the use of XXCOPYX settings.

Summary XXCOPY switches that check two directories: -------


/ src \
Files are classified into four groups; | ---+---
--------------------------------------------- | A / B | \
A files in src which do not exist in dst | | | |
B files in src which also exist in dst \ | C / D |
C files in dst which also exist in src ---+--- |
D files in dst which do not exist in src \ dst /
-------
/BB all files in A (none in B)
/BI all files in A plus files in B that are different in filetime or size
/BA all files in A plus files in B that are diff. in filetime, size or attr
/BX all files in A plus files in B that are different in filetime
/BZE all files in A plus files in B that are the same size
/BZL all files in A plus files in B that are larger
/BZS all files in A plus files in B that are smaller
/BZX all files in A plus files in B that are different in size
/BN all files in A plus files in B that have newer filetime
/Bo all files in A plus files in B that have older filetime
/BE all files in A plus files in B that have exactly the same time and size
/BS (none in A) files in B that have exactly the same time and size
/U (none in A) all files in B (subject to other switches)
/U/BI (none in A) files in B that are different in filetime or size

Note: all the variations in the backup switches (/Bx) include the files in A
with the exception of /BS to be consistent with the spirit of BACKUP.
As shown in the example (/U/BI), adding /U eliminates the files in A.

/RS files in A and/or B that satisfy other specified switches (for remove).
/RC same as /RS (for remove-after-copy).
/RD (none in D) files in C that would be overwritten (for remove).
/RX all files in D (for remove).

Note: /BS for copy usually accomplishes nothing but is useful as /RS/BS.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

Source Specifier:

XXCOPY's first argument (without regard to command switches) is


the source specifier. The source specifier is usually a path
specifier for the source. But, for XXCOPY (as well as for XCOPY),
the source specifier may contain the "Base" directory and an
optional file pattern specification whose subtleties are not fully
appreciated by many XXCOPY users.

The source specifier has three parts:

[ volume_spec ] [ base_dir ] [ pattern ]

Example (the destination specifier is omitted here):

xxcopy c:\mydir\*.doc
xxcopy "c:\program files\mydir\myfile.doc"
xxcopy \\myserver\drivec\config.sys

Here, the three parts in the source specifiers are quite obvious. In
the second example, the double-quotes (") allow XXCOPY to treat the
entire command argument as one source specifier. Without the double-
quotes, the embedded space character would make it two parameters

volume_spec

In most cases, the volume spec is a drive letter followed by a


colon (e.g., C: ). But, it can be a universal naming convention
(UNC) string for a volume in a network (e.g., \\myserver\drivec ).
If you omit volume_spec, the current drive is assumed.

base_dir
The name of the source directory. When the XXCOPY command
contains the subdirectory switch (/S and/or /E), the base_dir
specifier denotes the starting directory where the source
files and subdirectories are located. The base_dir part
must not contain wild card characters.

pattern

The last part within the source specifier denotes the pattern
matching string which may contain wildcard characters (* or ?).
It matches only the last components within a full filename.

You may omit any of the three parts, but you may need something
as the source specifier as the space holder so that you can specify
the destination specifier as the second non-switch argument. In
this case, you may use "." which denotes the current directory
as the source.

When you omit either the base_dir part or the pattern part,
that is, when a source specifier without a backslash separating the
two parts, the exact meaning of the command become ambiguous.
We will discuss the source specifier ambiguity in a later
article.

Destination Specifier:

The destination specifier has two parts:

[ volume_spec ] [ dest_dir ]

volume_spec

As for the source specifier case, the destination may contain


a volume specifier (e.g., C: ). If it is omitted, the volume
of the current directory will be used.

dest_dir

The name of the destination directory. Here, the destination


must be a directory name (which may or may not yet exist
in the destination volume). Unlike the original COPY command,
you are not allowed to specify wildcard characters in the
destination specifier which would be conveniently used to
perform renaming action while copying the files.

XXCOPY does not rename files while they are copied. therefore,
no wildcard characters have no place in dest_dir.

Unlike the source specifier counterpart, the destination specifier


consists of only two parts both of which are optional. When you
omit both of them, then the command line would have no explicit
argument as the destination specifier. Don't worry, the current
directory will be used as the default destination directory. Or,
you may just type "." which denotes the current directory explicitly.

Prefix and Delimiters:

XXCOPY's command switches always start with a slash (/) as the only
legitimate prefix (the Unix-style hyphen (-) is not recognized as
a switch prefix).

Usually, command line parameters are separated by blanks. However,


you may safely combine switches (the non source/destination specifiers)
without separating blanks for the command switches (e.g., /s/t/u/v).
However, you must separate the source and the destination specifiers
by blanks.

[ Table of Contents ] [ Show as Detached ] [ >> ]

S-ar putea să vă placă și