XXCOPY
[ Back to Table of Contents ] [ >> ]

XXCOPY TECHNICAL BULLETIN #01



From:    Kan Yabumoto           tech@xxcopy.com
To:      XXCOPY user
Subject: XXCOPY Command Parameters Reference
Date:    2007-03-10  Revised for ver 2.95.1
====================================================================

Basic Command Parameter Syntax:

  XXCOPY   source   destination    (simplified syntax)

  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.

  The first parameter is the source specifier and the second one is
  the destination specifier.  These two parameters must be in this
  order.  As common to 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.

  XXCOPY   source  [ destination ]

  By convention, an optional parameter is denoted in the syntax
  definition with a pair of square-brackets surrounding it.

  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 make XXCOPY so versatile and powerful.


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 (/).
     It 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 except when
  conflicting switches are specified, the rightmost switch will
  prevail.  More rules for special cases are discussed at the end
  of this article.  For a complete 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 embedded space must
      be surrounded by a pair of quotes (") 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 the switches.  Since the power of XXCOPY comes from
  these switches, you have to learn to live with them.  We try
  our best to keep these (still increasing) switches under control.
  Since the number of switches far exceeds the available alphabet,
  many of the switches use multiple characters.  For better or worse,
  the syntax adheres to the original XCOPY's syntax very closely.
  It is a mixed blessing, for sure.  So, when we feel very strongly,
  we took liberty in making improvements in a few exceptional cases.
  But, overall, if you are very familiar with how XCOPY works, there
  will be very little surprise for you.

  Let us just take a look at the full list of XXCOPY switches with
  a terse comment on each.  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-Wild-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 (AHSRC).
             You may use two or more /AT<mask> switches to specify multiple
             attributes required.  E.g., /ATA/ATH qualifies files with both
             the A(rchive) bit and the H(idden) bits.
             Or, 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 (AHSRC).
             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, AHSRC.
  /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 (AHSRC)
             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 are useful for backup and archive -----

        /BI  Backs up incrementally, different (by time/size) files only.
        /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 /r/i/bi/q/c/h/e/v/y).
        /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").

        /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 switch adds inclusive alternate templates -----

  /IN<tmpl>  Includes an alternate filename template (tmpl).
             
             You may specify as many alternate filename patterns as you want.
             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 (consists of up to 3 parts):

               for file,  [ dir_spec\ ] [ *\ ] [ ftemplate ]
               for dir,   [ dir_spec\ ] [ *\ ] [ dtemplate ]

               dir_spec   is always followed by a backslash (\).  It specifies
                          a directory (or directories with wildcard) which
                          are relative to the source directory unless it
                          starts with a \.  A wildcard specifier is allowed
                          only in the last element of dir_spec.

               *\         This second part specifies that the exclusion
                          applies to all subdirectories under dir_spec.

               ftemplate  File_template, must not contain backslash (\).
                          It may contain wildcard characters (* and/or ?).

               dtemplate  Directory_template, the template must be terminated
                          by one of the following four ending (three types)

                            dirname\*\*   full directory
                            dirname\      full directory (same as dirname\*\*)
                            dirname\*     partial directory, files only
                            dirname\?\*   partial directory, subdirs only

                          The dirname part may have wildcards (* and/or ?).

             Any of the three parts can be omitted.

             There are 11 classes in xspecs as follows.

                                D dir_spec\ftmpl       H dir_spec\*\ftmpl
               A dir_spec\*     E dir_spec\dtmpl\*     I dir_spec\*\dtmpl\*
               B dir_spec\?\*   F dir_spec\dtmpl\?\*   J dir_spec\*\dtmpl\?\*
               C dir_spec\*\*   G dir_spec\dtmpl\*\*   K dir_spec\*\dtmpl\*\*

             If dir_spec is omitted, the file_template applies to all subdirs.
             XXCOPY optimizes the exclusion parameter by eliminating
             some redundant specifiers.
             Use "/W/oX" with xspec to test the syntax.

             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 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.

        /FT  Legacy switch; replaced by /FF+2.
        /FR  Legacy switch; replaced by /FF-2.

  -----  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.

  -----  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).

     /SZ<n>  Legacy switch; replaced by /TR<n>.

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

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

      Note:  The TR<n> switch replaces the legacy SZ<n> switch.

  -----  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).
       /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).
      /SGNo  Gathers files into one-level directory (Newest only).
      /SGoo  Gathers files into one-level directory (Oldest only).
       /SG0  Cancels file-gather switches (/SG...).
        /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 check the destination directory -----

         /I  If destination does not exist and copying more than one file,
             assumes that destination must be a directory (no prompting).
             Note: when the destination specifier ends with a backslash,
             it declares as a directory which implicitly sets the /I switch.
        /IA  Continues if destination is absent (terminates if 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 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 starting each directory with options for...
             Y (Yes), N (No), A (All), R (Remaining dirs), S (This & subdirs).
        /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).
        /PZ  Prompts you for confirmation of the dst (for /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).
       /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 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 (ignores match in alias).
       /NP0  Uses loose name matching (default, 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.)

         /1  DATMAN One-pass copy (when copying from DATMAN tape, default).
         /0  Disables DATMAN One-pass copy (not recommended, but allowed).
         /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).
        /VE  Displays only error cases of DATMAN 2-pass verify (/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
                Z   file size in bytes
                A   file attributes: A(rchive),H(idden),S(system),R(eadonly)
                S   short name (8.3)
                L   long name with full directory path

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

             Note: The format specified by /FM<items> will be used if /L
                   is not followed by its 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
                Z   file size in bytes
                A   file attributes: A(rchive),H(idden),S(system),R(eadonly)
                S   short name (8.3)
                L   long name with full directory path

             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-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

        /CL  Legacy switch, replaced by /CA

  -----  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.
        /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.
        /oQ  Surrounds pathname output with quotation marks
        /o0  Cancels the /oN or /oA switch specified earlier.

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

     /oP<n>  Parameter (command switch detailed) list.
     /oI<n>  Include item (alternate file template) list. 
     /oX<n>  Exclude item list.
     /oF<n>  File list (files which were successfully operated).
     /oS<n>  Skipped file list (with the reason why skipped).
     /oD<n>  Deleted file list (by a /Z or /ZY switch).
     /oE<n>  Error summary with the system error code

      These items can be controlled by the suffix <n> value, 0-3.

             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.    

     /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".
/$II-IWK-K$  Expands to the ISO 8601 year-week --> "02-W52-3".

       /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.
 /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.

  -----  The following switches are DATMAN specific -----

             DATMAN is a revolutionary tape control software also published
             by Pixelab, Inc.  It makes a tape drive behave almost like a disk.
         /J  Forces DATMAN catalog (journal) flush.
        /J0  Suppresses DATMAN's automatic catalog (journal) flush.
        /J1  Flushes DATMAN catalog when needed (default).
        /J2  Flushes DATMAN catalog unconditionally at the end.
      /G<n>  Sets DATMAN N-Group (redundant) write. (<n> : 0 - 7).
             e.g., /G1 writes the same data twice on DATMAN tape.

  -----  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
 /BX   all files in A plus  files in B that are different in filetime
 /BZX  all files in A plus  files in B that are different in 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
 /BZE  all files in A plus  files in B that are the same 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 (") make 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:

  Earlier versions of XXCOPY switch used to accept either a slash (/)
  or a hyphen (-) followed by at least one letter or digit.  That was
  started with the DOS version (XXCOPY16.EXE) which did not have to
  resolve the hyphen character from filename before the long name
  was introduced.   However, due to the fact that the hyphen is now
  a legal character in Win32's long filename, this practice had to
  be abandoned.  It became clear lately that the over all price to
  pay in the twisted syntax rules to support of the Unix-like switch
  prefix has become too high for the now-questionable "benefit".

  Usually, command line parameters are separated by blanks. However,
  you may safely combine switches 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.



© Copyright 2008 Pixelab, Inc. All rights reserved.

[ XXCOPY Home ] [ Table of Contents ] [ >> ]

Join the XXCOPY group