Technical Bulletins


XXCOPY Technical Bulletins (Reference)



  • XXTB #01 ... XXCOPY Command Parameters Reference
  • XXTB #02 ... What are the differences between XCOPY and XXCOPY?
  • XXTB #03 ... Problems in filename aliases (8.3 names) in Win32
  • XXTB #04 ... What is and what is not included for copy
  • XXTB #05 ... The Exclusion Specifier in XXCOPY
  • XXTB #06 ... File Attributes: what they are and how to use them.
  • XXTB #07 ... XXCOPY's Handling the case of Cyclic Copy
  • XXTB #08 ... Short names made by Win95/98 and by WinNT/2K/XP
  • XXTB #09 ... Worldwide Network of Download Sites for XXCOPY
  • XXTB #10 ... Cloning the Win9x system disk using XXCOPY
  • XXTB #11 ... XXCOPY Cookbook: Recipes of common usages
  • XXTB #12 ... The file removal features in XXCOPY
  • XXTB #13 ... XXCOPY Frequently Asked Questions (FAQ)
  • XXTB #14 ... Tutorials in Command Line Operations
  • XXTB #15 ... Windows File Date and Time
  • XXTB #16 ... Gathering files into one directory using XXCOPY
  • XXTB #17 ... Selecting files by file date and time using XXCOPY
  • XXTB #18 ... The filename matching schemes in Win32 and DOS
  • XXTB #19 ... XXCOPY in batch files
  • XXTB #20 ... More on Directory Cloning using XXCOPY
  • XXTB #21 ... XXCOPY in a network environment
  • XXTB #22 ... The leading backslash in a filespec
  • XXTB #23 ... The enhanced features of XXCOPY at a glance
  • XXTB #24 ... XXCOPY's Macro processing feature
  • XXTB #25 ... XXCOPY Command Line Syntax
  • XXTB #26 ... XXCOPY Command Reference Alphabetic Listing
  • XXTB #27 ... XXCOPY Command Reference Functional Classification
  • XXTB #28 ... The Wild-Wild-Source: the source spec with wildcards
  • XXTB #29 ... The Windows 98 Startup Disk
  • XXTB #30 ... Feature Comparison: XXCOPY vs ROBOCOPY
  • XXTB #31 ... XXCOPY's Exit Code (for ERRORLEVEL checking)
  • XXTB #32 ... A better boot diskette for Win9x/ME
  • XXTB #33 ... A better boot diskette for WinNT/2000/XP
  • XXTB #34 ... The differences between XXCOPY Pro and Freeware
  • XXTB #35 ... How XXCOPY-Pro manages the site license.
  • XXTB #36 ... Norton Ghost and XXCOPY
  • XXTB #37 ... The text files for XXCOPY command
  • XXTB #38 ... Creating a Shortcut from the command line (batch file)
  • XXTB #39 ... XXCOPY.CHM --- The HTML-style Help File for XXCOPY
  • XXTB #40 ... A very quick recovery scheme for Win9X/ME
  • XXTB #41 ... File Compression on the NTFS Volume
  • XXTB #42 ... XXCOPY on Windows Vista --- living with UAC
  • XXTB #43 ... XXConsole -- A Super Console Generator
  • XXTB #44 ... Concurrent access of a file
  • XXTB #45 ... Comparing File Data
  • XXTB #46 ... The Prompt on Processing Directories
  • XXTB #80 ... A Minimum WinXP Install
  • XXTB #81 ... A Minimum Win9X Install
  • XXTB #82 ... A Minimum Win9X File List
  • XXTB #90 ... XXCOPY Corporate Site License
  • XXTB #99 ... Revision History of XXCOPY
    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 (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.)
    
             /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.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #02


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: What are the differences between XCOPY and XXCOPY?
    Date:    2000-11-30 (revised)
    ====================================================================
    
    Introduction:
    
      When we designed XXCOPY, one of the key design principles was to
      keep the command syntax and the behavior of XXCOPY as close to
      those of the original XCOPY program.  Although we did not agree
      with all the idiosyncrasies of XCOPY, modifying anything XCOPY
      already implements would cause substantial confusion to the users.
      If we change things arbitrarily, any incremental improvements we
      may add would be more than offset by the burden of remembering
      the specifics of changes we make.  That would not benefit anyone.
    
      Therefore, the changes we added to XXCOPY on purpose are kept to
      the absolute minimum.  The changes we made are those with
      substantial benefits to the users.
    
    The key arguments, source and destination:
    
      Like XCOPY's predecessor, the built-in COPY command of COMMAND.COM,
      XXCOPY has two basic arguments without counting any other switches.
    
        XXCOPY source  [ destination ]
    
      Here, the semantics of the first argument (source) are almost the
      same as the first argument of the traditional XCOPY command.  It
      is the source file/directory specifier, which is a combination of
      the source directory and optional filename pattern specifier.
      To be precise, this combination of directory specification with
      the filename pattern connected by a backslash does not conform
      to a regular so-called pathname specifications. (We will discuss
      the exact definition of the source specifier in another Technical
      Bulletin article in full detail.)  Just remember that the source
      specifier is pretty much the same as that of XCOPY.
    
      The destination specifier is optional as in the case of the
      original XCOPY and COPY commands.  When the destination is not
      specified, XXCOPY uses the current directory as the destination
      direction.
    
    
    Destination specifier (Difference #1):
    
      In XXCOPY, the destination specifier (when supplied by the user)
      refers to the name of a directory whether it exists or to be
      created by the command.  In any event, the destination never
      specifies any particular filename.  It always specifies the name
      of the destination DIRECTORY.
    
      The reason for this change was the confusing and bothersome
      behavior of XCOPY.  For one thing, when you specify a non-exist
      directory as the destination of XCOPY, you would be greeted by
      the familiar prompt:
    
          Does XXXX specify a filename
          or directory name on the target
          (F = file, D = directory)?
    
      In nearly all cases, you would type D and sigh a long DUHHHHHHH!!!!
      Yet, because XCOPY allows the action to include renaming the file
      while it is being copied, this ambiguity arises.  It is simply
      carrying on the legacy of the COPY command.  While the copy command's
      simplistic "rename-while-you-copy" features using a wildcard
      specifier works, we consider the action quite dangerous.
      When you use a wildcard with "rename-while-copy" feature which
      involves a large number of files, you may accidentally create a
      filename collision, which would abort the "rename-while-copy" action
      in the middle.  The result would be a big mess of partially
      renamed files.
    
      We consider the "rename-while-copy" a source of much trouble and
      therefore, we discourage your using it.  After all, XXCOPY is not
      designed to handle one or two files.  You can always use the simple
      COPY command to do just that.  Therefore, in our opinion, eliminating
      the double meaning of the destination specifier from XXCOPY's second
      argument, we can avoid the side-effects of the "rename-while-copy"
      operation altogether and also eliminate the bothersome prompt of
      "Do you mean F = File, or D = Directory".  Also, we are sure that
      everybody has experienced the huge file which is accidentally
      created by a simple COPY command with a directory as the source
      and a non-existent directory as the destination.  The copy command
      interprets the destination as a filename rather than a directory and
      accumulates all the source files combined into a huge pile of useless
      bytes.)  Anyway, we had enough confusion with the double meaning
      of the destination specifier.  XXCOPY dares to correct this problem.
    
      With XXCOPY, the destination is always a directory, never a file.
    
    
    XXCOPY.EXE and XXCOPY16.EXE (Difference #2):
    
      In the case of XCOPY, it automatically switches between XCOPY.EXE
      (a 16-bit program) and XCOPY32.EXE depending on the environment.
      In fact it is quite convenient for most users to forget about
      the distinction between XCOPY and XCOPY32.  Some users may not
      even know the existence of XCOPY32.EXE.  The actual mechanism is
      that when you run XCOPY.EXE in the Win32 environment, XCOPY.EXE
      automatically detects the current environment and will execute
      XCOPY32.EXE instead.  We also consider this feature quite dangerous.
      That is because the behaviors of XCOPY and XCOPY32 are not identical.
      For example, the treatments of a pathspec with wildcard characters
      in the DOS and Win32 environments are significantly different.
      Therefore, any large-scale batch file invocation should distinguish
      the usage of XCOPY and XCOPY32 to be safe.
    
      Due to that consideration, we feel the danger of having unintended
      COPY operations performed in the different machine environments
      outweighs the convenience of the automatic invocation of the 32-bit
      version.  Therefore, XXCOPY (which is the 32-bit version) will NOT
      automatically invoke the 16-bit counterpart.  You must select the
      appropriate version when you need the distinction.  Since the
      16-bit version, XXCOPY16.EXE, is seldom used, we chose the scheme
      where the shorter name is for the 32-bit version.  Also, in a
      32-bit environment, XXCOPY does not have the overhead of XCOPY,
      which always loads and runs XCOPY.EXE before XCOPY32.EXE, 
      unless you specify XXCOPY32 in the first place.
    
      XXCOPY is always in 32-bit and XXCOPY16 is always in 16-bit.
    
    
    The /C switch as the default (Difference #3):
    
      XCOPY32 added the much needed switch, "/C" which allows an
      automatic continuation of the copy operations after encountering
      an error condition.  The C stands for "Continue on error".
    
      Before Microsoft introduced Windows 95, and therefore, the new
      XCOPY32.EXE utility, DATMAN-DOS users demanded a solution to
      the "share-violation" problem in a backup job of NetWare server.
      Even within a modest sized network, there are always a few files
      which are open at the time of a server backup job.  When XCOPY
      tries to open a file which is already opened by another process,
      the access results in  the error condition where the user had
      only three choices:  Abort, Retry, or Fail.
    
      None of these choices would let XCOPY continue the operation.
      As a matter of fact, XXCOPY's predecessor (DCOPY.EXE) was born
      to correct this problem even in the DOS-only days.  The first
      enhancement to the XCOPY command was the /C switch.  Now, with
      XCOPY32, which supplies the much-needed switch, the problem was
      pretty much behind us.
    
      We had XXCOPY's /C switch work exactly the way XCOPY32's /C
      switch works.  When it was specified, an error condition that
      would have aborted the entire copy operations will continue
      until all the qualified files are copied.  Alas, the most
      frequent technical support issue with the earlier versions
      of XXCOPY was due to the omission of the /C switch.  After
      answering many tech support Emails, we have reached the
      conclusion that Microsoft should have made the /C switch its
      default mode with a provision to disable it.
    
      For this reason, we broke our rule of adhering to XCOPY32's
      behavior exactly, for better or worse.  Here, we made XXCOPY's
      implementation of the /C switch the exact opposite of how XCOPY32
      handles the case.  We believe it is in the best interest of the
      users.  As of this writing, Microsoft's 16-bit counterpart,
      XCOPY does not have the /C switch.
    
      With XXCOPY (also with XXCOPY16), the /C switch is automatically
      invoked by default.  You need to specify /C0 to disable this
      feature and to allow XXCOPY to terminate at the first instance
      of an error condition.
    
    
    The /T switch always enables /E (Difference #4):
    
      Since the /T switch is to construct the directory tree (without
      the files), it makes no sense to run it without /S or /E (which
      handles subdirectories).  We consider the /T/S combination
      quite useless and hence chose to always include the E switch
      implicitly.  We believe the /T switch is now trouble free.
    
    
    The use of quotatoin marks in a command line (Difference #5):
    
      When a pathname contains an embedded space, the whole string
      must be surrounded by a pair of quotation marks (").
    
      Microsoft's XCOPY allows a very liberal usage of quotation
      marks to an extent it even accepts bizarre strings.  For
      example, XCOPY allows the following strings without problem:
      
         "c:\Program Files\My Directory\Myfile.doc"     // OK
         "c:\Progra""m Files\My Directory\Myfile.doc"   // two pairs
         c:\Program" Files\My "Directory\myfile.doc     // bizarre
    
      We feel XXCOPY should not allow such questionable constructs
      even though they are accepted by XCOPY.  While it is not
      impossible for us to make XXCOPY imitate the behavior closely,
      we would have hard time defining and explaining the exact
      syntactic rules.  So, we chose to deviate from XCOPY's rules.
      
      XXCOPY's rule for the quotation mark is very simple:
    
        The quotation marks must be at the both ends of a pathname.
    
    
    Other differences:
    
      In almost all other cases, the differences between Microsoft's
      XCOPY and our XXCOPY are a result of enhancements rather than
      alteration of the XCOPY behavior which already existed.
    
      With the few notable exceptions discussed in this article, the
      differences between XCOPY and XXCOPY are remarkably small.
      For example, XXCOPY pays attention to the short name alias
      which preserves the short name after the copy (TB#02).  But,
      this is a pure "improvement" rather than "change" which does
      not require user attention or precaution.
    
      Therefore, you need not worry much about how to use XXCOPY
      if you already know XCOPY.  You can pick just a few new
      features when you want to learn XXCOPY.  Over time, you may
      come to like XXCOPY and exploit its unique features to write
      your own very powerful batch script for a backup operation.
    
    
    XXCOPY's major enhancements:
    
      0. Wild-src  Wild-Wild-Source, multi-level, multi-wildcard source
      1. /X        exclusion specifier and related switches (/EX)
      2. /IN       inclusion specifier for alternate file pattern template
      3. /Bx       variations in backup related switches
      4. /NX       retains the short name exactly
      5. /NS /NL   renaming short name and long name based on the other
      6. /D        date matching with many variations
      7. /Rx /Z    removes files using the versatile file selection schemes
      8. /SG/SX    gathering files or flattening a directory tree
      9. /SZ:      select file by the file size (range)
     10. /CC /CCY  cyclic copy cases handled with the exclusion method.
    
    
      If you have a suggestion for a new XXCOPY feature, tell us about
      it.  We will consider any user feedback very seriously.
      Please send E-Mail to <tech@xxcopy.com> for comments, suggestions,
      questions, etc.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #03


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Problems in filename aliases (8.3 names) in Win32
    Date:    1999-11-27
    ====================================================================
    
    Background:
    
      When Microsoft implemented the long filename in Windows 95,
      it came up with a scheme which assigns an alias (or short name in
      the so-called 8.3 format) for every long name.  Typically, a short
      name starts with the first 6 letters in the long name followed by
      a tilde and a digit, (numeric tail like XXXXXX~1.XXX), discarding
      remaining characters except the three-letter extension.  The short
      name is synthesized by the file system driver for the volume, in
      such a way that all filenames become unique one another within
      a given directory.  The rule to assign the numeric tail is very
      simple; it picks the smallest decimal value not yet claimed in the
      directory.
    
      As long as the aliases are used by legacy programs to access files,
      the actual filename assigned to a file should not be very important.
      But the truth is that even Windows 95 itself accesses certain files
      using their short name aliases.  One notable situation is when the
      most primitive virtual drivers (VxD) are loaded at the beginning
      of Windows 95 system start up sequence.  Since the long name support
      is provided by a module called IFSMgr (InstallableFileSystem Manager)
      which is itself a VxD module, locating and accessing the VxD files
      are all performed strictly using the short name alias.  If you
      examine various parts of the system registry, you will find many
      8.3 name strings.  In short, the system relies on the 8.3 naming
      scheme in a very crucial manner.
    
    
    The problem:
    
      The problem arises when a directory contains a number of files
      whose aliases share a common base part (differing only by the numeric
      tails).  When you copy these files to another directory, the
      aliases will be assigned by the simple (first-come-first-served)
      algorithm, the first such file copied to the destination directory
      will have numeric tail of ~1 regardless of what was its alias
      in the source directory.  Therefore, the Windows operating system
      does *NOT* preserve the alias after copying.  We consider this a
      very serious defect in the file system design.  Most file copy
      programs ignore this aspect in file copying.  This includes
      Explorer (drag-and-drop), COPY, and XCOPY.
    
    
    Example:
    
      Here, we make a simple sequence in a DOS Box to illustrate the point.
      It is assumed that you have the \autoexec.bat file handy (can be any
      file).  Let us create a pair of files with names that would have the
      same short name base for the alias.
    
         C:\> mkdir \src
         C:\> copy  \autoexec.bat  \src\LongNameA.bat
         C:\> copy  \autoexec.bat  \src\LongNameB.bat
         C:\> dir   \src
    
         LONGNA~1.BAT       1234       11-21-99 11:27p LongNameA.bat
         LONGNA~2.BAT       1234       11-21-99 11:27p LongNameB.bat
    
      Use the traditional method to copy the files.  When you use another
      method like Drag-and-Drop, you would get the same result.  First,
      pick the file whose short name numeric tail does not end with ~1.
    
         C:\> mkdir \dst
         C:\> copy  \src\LongNameB.bat  \dst
         C:\> copy  \src\LongNameA.bat  \dst
         C:\> dir   \dst
    
         LONGNA~1.BAT       1234       11-21-99 11:27p LongNameB.bat
         LONGNA~2.BAT       1234       11-21-99 11:27p LongNameA.bat
    
       Here, the first file created in the destination received the numeric
       tail of ~1, even though its alias in the source was not that.
       If you don't see the difference in the left hand side (the aliases),
       see the long names to your right (---B and ---A are opposite).
    
    
    Enter XXCOPY:
    
       Now, try the same operation using XXCOPY in the \new directory.
    
         C:\> mkdir  \new
         C:\> xxcopy \src\LongnameB.bat  \new
         C:\> xxcopy \src\LongnameA.bat  \new
         C:\> dir    \new
    
         LONGNA~2.BAT       1234       11-21-99 11:27p LongNameB.bat
         LONGNA~1.BAT       1234       11-21-99 11:27p LongNameA.bat
    
       Here, the files in the \src directory and in the \new directory
       match exactly (both the long names and the aliases) albeit the
       new order reflects the order of copying.
    
    
    Other cases:
    
       The above example is just one of the many problems with aliases.
       For example, when you delete the file with the numeric tail of
       ---~1 in the source directory and copy the files; the first
       files copied to the destination will be assigned with an alias
       ending with ---~1.  In essence, the short name alias is
       systematically synthesized by Windows kernel without regard to
       what the original alias in the source directory was.  This kind
       of discrepancies in file and directory names lead to subtle but
       serious problems which are often very difficult to even diagnose.
    
    
    How safe is XXCOPY?
    
       XXCOPY performs the alias name change using only published
       standard Win32 file I/O API.  XXCOPY does not attempt to
       manipulate the raw directory data structure of the file system.
       Nor does XXCOPY perform any unorthodox techniques to implement
       the alias matching feature.  The operation utilizes a combination
       of simple file-renaming system calls.  Therefore, it is completely
       safe.
    
       On the other hand, when the destination directory already has
       a file with the needed alias (i.e., a case of alias name
       collision), XXCOPY does not perform such an operation which
       would otherwise create an invalid directory data.  Of course,
       the same name for more than one file is No No in a file system.
    
       Since XXCOPY supports remote machines over a network, the alias
       (8.3 name) support function also works across network.
    
    
    Win95/98 and WinNT/2000/XP:
    
       If your use a dual-boot system (Win95/98 and WinNT/2000/XP), there
       is one more pitfall which is related to the shortname.
       Please read our new article, XXTB #08.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #04


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: What is and what is not included for copy
    Date:    2001-01-18
    ====================================================================
    
    [ Note:  this article is about XXCOPY's file selection mechanism
             in general, not about the recently added /IN switch that
             "includes" alternate filename pattern ]
    
    
    The problem of being "Too Powerful"...
    
      With the huge set of command switches offered by XXCOPY, even
      a serious user starts to wonder if a particular file is included
      in the XXCOPY operation or not.  Indeed, there are a number of
      switches which sound very similar and become quite confusing
      which of the switches has "precedence" over the other.  Yet,
      there is hardly any mention of precedence in the XXCOPY help
      and documentation.  This article will give you a simple rule
      which resolves all such questions and gives you the confidence you
      need when you use XXCOPY in your day-to-day computing.
    
    
    Combining switches:
    
      Some XXCOPY switches suggest an inclusion of files with certain
      characteristics.  For example,
    
         XXCOPY  C:\mydir\   D:\newdir\   /H
    
      It is understood by many XXCOPY users that with the /H switch,
      hidden and system files (which would normally be excluded) will
      be "included" in the copy operation.  Let us add another switch.
    
         XXCOPY  C:\mydir\   D:\newdir\   /H /U
    
      The /U switch is used to "update" existing files in the destination
      directory.  In this case (/H/U), hidden files will be included in the
      operation by the /H switch,  but the files which are not already
      present in the destination will be excluded by the /U switch.  Then,
      what about the files which are hidden (to be included) but are
      not present in destination (to be excluded)?  The question seems to
      be whether /H or /U has the precedence.  Let's add some more.
    
         XXCOPY  C:\mydir\   D:\newdir\   /H /U /BI
    
      /BI stands for "Incremental Backup" meaning that it will select
      files which are different (by comparing the file date and file
      size between the files of the same name in the source and the
      destination).  The /BI switch includes those files which exists
      in the source but not in the destination.  But, if you combine the
      three, /H/U/BI, then the /U switch (which excludes new files to the
      destination) and the /BI switch (which includes new files) seem to
      contradict each other while the effect of /H seems fine.
    
      Does the order of these switch makes the difference?  The answer is
      No.  At least that is not the case because /U and /BI are not in a
      mutually exclusive set of switches.  But, clearly, these two switches
      seems to have opposing effects on the files which do not exist in the
      destination directory.  What is the precedence?  What is going on?
    
    
    The golden rule:
    
      XXCOPY's switches are all exclusionary.
    
      Well, it has some element of over-simplification, but it is the
      shortest rule that you can remember.  Each XXCOPY switch excludes
      certain group of files by some measure.  By adding another switch,
      some more files are excluded.   Obviously, there are many
      switches in XXCOPY which do not participate in the file selection
      process.  For example, the /W switch is to let XXCOPY wait for a
      keyboard input before the copy action really begins.  It has
      nothing to do with qualifying files for inclusion or exclusion.
      But, for all the command switches which determine whether a
      file is to be copied or not, the above golden rule applies.
    
    
    The exclusion process:
    
      If you consider that all of XXCOPY file-selection switches are
      exclusionary parameters, everything will start making sense.
      And you will realize that the precedence of switches becomes a moot
      point.  You may need to view some of the switches from a different
      angle.  Here, we need some rephrasing of the nature of the switches.
    
         XXCOPY  C:\mydir\    D:\newdir\  /H
    
      Earlier, we said /H was to include hidden/system files.  Now, let
      us rephrase it by saying "/H does not exclude hidden/system files".
      Yes, it is still awkward.  But, remember this is a case where the
      default switch in the same category (/H0) did the exclusion and
      you are simply negating it.  Let us revisit the implied case;
    
         XXCOPY  C:\mydir\    D:\newdir\
         XXCOPY  C:\mydir\    D:\newdir\  /H0
    
      These two lines produce exactly the same result.  Since it is a
      default, most XXCOPY users do not add such a switch.  These lines
      should read that "the /H0 switch excludes hidden/system files from
      the copy operation".
    
      Once more,
    
         XXCOPY  C:\mydir\    D:\newdir\  /H
    
      We now know that the /H switch simply negates the default exclusion.
      The wording, "/H does not exclude hidden/system files" sounds OK, now.
    
         XXCOPY  C:\mydir\    D:\newdir\  /H /U
    
      Adding the /U switch, it becomes "/H does not exclude hidden/system
      files" but "/U excludes files that are not present in the destination
      directory".  Here, the exclusion rule of /U goes by the face value.
    
         XXCOPY  C:\mydir\    D:\newdir\   /H /U /BI
    
      Again, we have the /BI (incremental backup) switch which reads as
      "/BI excludes files that exist in destination with identical time
      and size".  This does not contradict with the /U switch which
      "excludes files that are not present in the destination".  All of
      the excluded files will be excluded.  That's simple.
    
    
    Exclusion by the name:
    
      Of course, by far, the most obvious parameter to be used in the
      exclusion process is by the directory and filename.  Because it
      gives us a very wide range of opportunities to exploit in
      expressing what to exclude, we did put a lot of thoughts in the
      design of this (probably the single most significant enhancement)
      feature.  Therefore, the /X switch deserves its own treatment
      in a separate article, XXTB #05.
    
      It is indeed a very natural way of excluding a group of files.
      Now, to come to think of it, we wonder why we have not seen
      similar features in most other file copy utilities...
    
    
    Conclusion:
    
      In essence, each command switch has its own way of specifying the
      files to exclude.  Each and every switch adds more exclusions.
      Determining whether a file is excluded from the copy operation is
      now easy.  Once a file is excluded by a switch, it is out and gone.
      Therefore, the more switches you add, the more files you are going
      to exclude from the copy operation.
    
      As we add more and more switches, it has become increasingly
      difficult for even experienced users to remember all the switches
      (it's now over 120 variations and still growing).  So, we added
      a new feature called "Smart-Help".  Just add "/?" at the end
      (or anywhere) in your XXCOPY command line.  It will select only
      the switches you specified in the line, their related switches and
      its opposing and mutually-exclusive switches as a group.  We find
      this new feature quite convenient.  You should definitely try it.
    
        Example:    XXCOPY c:\mydir d:\yourdir  /I /BI /FT /?
    
      To further assist the user in constructing the right combination
      of the command switches, XXCOPY now a set of useful switches
      which list pertinent command parameters.
    
        /OP       outputs parameter list (in exclusionary wording)
        /OX       outputs exclusion list (after optimization)
        /DEBUG    displays source and destination and prompts before continue
        /DEBUGX   displays source and destination and terminates
        /W        waits for user keyboard input after /OP and /OX switch
    
      Many users find the output text generated by the /OP switch more
      understandable than any other documentation of XXCOPY.  So, if you
      have any doubt on the effect of switches, just add "/OP | MORE"
      at the end of the command line.  So, to review the whole thing,
      a good alternative to the "/?" trick is "/OP/W".
    
        Example:    XXCOPY  c:\mydir d:\yourdir  /I /BI /FT /OP /W
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #05


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: The Exclusion specifier in XXCOPY
    Date:    2009-01-13  (revised)
    ====================================================================
    
    
    Much of the mostly hidden power of XXCOPY lies in the exclusion
    mechanism.  Starting with v.2.97.7 (2009-01-13), the exclusion
    specifier is fully compatible with the "Wild-Wildcard" feature.
    That is, you may use wildcard characters (* and ?) anywhere in
    the exclusion specifier in any number of times.  (Earlier 
    versions of XXCOPY had complicated rules on the wildcard usage).
    
    
    XXCOPY Exclusion switch syntax
    
      /X<xspec>       excludes the file or directory item given by
                      <xspec> which is an exclusion specifier.
                      If the specifier contains an embedded space,
                      the specifier must be surrounded by a pair
                      of double-quotes (").
    
      /EX<xfile>      specifies a text file whose name is <xfile>
                      which contains a list of <xspec> separated by space.
    
    
    
      You may specify as many exclusion specifiers as you like.
    
    
    Some examples of the /X switch
    
      The exclusion parameter must be specified immeidately after /X
      (without a space).
    
        /Xc:\mydir\myfile.txt // specifies just a single file
        /X*.tmp               // all files that end with ".tmp"
        /Xabc*                // all files that start with "abc"
    
      To improve readability, we suggest inserting a colon after X.
      Here are more examples:
    
        /X:mydir\             // the entire directory, "mydir" in the source
        /X:mydir\*\*          // same as /Xmydir\ which is a shortcut
        /X:mydir\*\*.tmp      // inside mydir, all files matching "*.tmp"
        /X:my*xyz\*\abc*.c    // in directories that match my*xyz, all "abc*.c"
        /X:*\cache\           // multiple-level subdirectories
        /X:*\cache\*\*        // same as above with a trailing backslash
        /X:*\cach?\*\*        // multiple-level subdir spec may have wildcards
        /X:"\Program Files\"  // use quotes (") with a pattern with a space
    
    
      Here, you may see the glimpse of the powerful syntax in the exclusion
      specifier.  The first example seems the most straight forward.  The
      fourth example which ends with a backslash is a shorthand of for the
      common case of excluding a directory (it abbreviates "*\*" which follows).
      Therefore, all of the above examples except the first one contain
      or imply at least one wildcard specifier.  The last example includes
      one asterisks in each of the three parts.
    
      Don't worry about the complexity yet.  At least the first example shows
      a case which you can use it immediately without any further reading.
      Yes, if you have energy to list all of the files you want to exclude,
      you may painstakingly list all of such files by giving the full
      file specification of each file.  Since you will soon run out of the
      command line space, you will probably want to set up a text file using
      the /EX switch.
    
    
      E.g.,  /EXmyexcl.lst
    
       and myexcl.lst  contains the following specifiers:
    
         // this is a comment line
         c:\win386.swp               // comment may start like this
         c:\autoexec.bat  myfile.tmp // one line may have multiple items
         "c:\program files"          // use quotes (") for embedded space
         mydir\myfile.txt            // pathspec relative to the source dir
         yourdir\                    // entire yourdir\*\*
    
    
    Characteristics of exclusion specifier (a short explanation):
    
        1.  The Wild-Wildcard feature fully supported for exclusion.
        2.  A pattern for direcotires always ends with a backslash.
        3.  A pattern for files has no trailing backslash.
        4.  A relative specifier is relative to the source base directory.
    
    
    Syntactic rules of exclusion specifier:
    
        1.  Add the exclusion item immediately (without space) after /X.
            
             /Xmyfile.txt          // exclude "myfile.txt" anywhere
    
        2.  You may insert an optional colon (:) between /X and the rest.
    
             /X:xyz.doc            // the colon improves the readability
    
        3.  The trailing backslash distinguishes directory from file.
    
             /X:Windows\          // specifies the "Windows" directory
             /X:pagefile.sys      // specifies the "pagefile.sys" file
    
        4.  Use a pair of quotes (") for an exclusion item with embeded space.
    
             /X:"\Program Files\"  // the space would split the string
    
        5.  Absolute exclusion specifiers start with a backslash
            (with an optional drive letter or UNC pattern).
    
             /X:c:\mydir\myfile.txt     // an absolute pattern
             /X:\mydir\myrecord.doc     // you may omit the drive letter
             /X:\\john\c\windows\       // UNC always starts with \\
    
        6.  Relative exclusion specifiers (without leading backslash)
            are relative to the source base specifier.
    
             /X:dir_abc\myfile.txt      // relative to the source base dir
    
        7.  A bare exclusion item (without any backslash) is treated
            as a file name pattern that applies to all directories.
    
             /X:desktop.ini             // equivalent to /X:*\desktop.ini
             /X:*.mp3                   // equivalent to /X:*\*.mp3
    
            This feature allows for a filename pattern to apply for all
            directories.  On the other hand, you may want to specify a
            file pattern that explicitly apply only to the files in the
            source base directory.  In such a case, use a ".\" prefix.
    
             /X:.\*.tmp                 // for files in the top directory
    
        8.  A bare directory pattern (the only backslash is at the end)
            is treated a pattern that applies only to the source base
            directory, unlike the bare file name case exlained above.
    
             /X:dir_xyz\                // applies only the top directory
             /X:.\dir_xyz\              // the same as the one above
    
    
    The Wild-Wildcard feature in exclusion specifier:
    
        Starting with v.2.97.7 (2009-01-01), you may use wildcard character
        anywhere in an exclusion specifier for any number of times.
    
           Astrisk (*) denotes a string of zero or more of any character.
    
           Question Mark (?) denotes exactly one character.
    
    
             /X:*.mp3      // any file that ends with ".mp3"
             /X:abc*\      // any directory that starts with "abc"
             /X:xyz???     // starts with xyx followed with 3 more chars
             /X:*a*        // a filename that has at least one letter "a"
    
    
        The Special "wild subdirectory"  (..\*\..) notation:
        
            The \*\ (an asterisk sandwiched by backslashes) sequence
            denotes a pathname pattern with zero or more of directories.
    
             /X:c:\mydir\*\abc\    excludes the following directories
    
                c:\mydir\abc\
                c:\mydir\xyz\abc\
                c:\mydir\klm\xyz\abc\
    
            Such a pattern does not always match the first one.
    
             /X:c:\mydir\*\a\b\    excludes the following directories
    
                c:\mydir\a\b\           // the first instance
                c:\mydir\a\xyz\a\b\     // 1st \a\ does not but 2nd one does
    
    
     Syntax rule for the Exclusion List File (/EX).
    
        An "Exclusion List File" specified in the /EX switch is a plain
        text file which contains a list of exclusion specifiers.
        You may list as many exclusion specifiers in one line.
        Exclusion specifiers are separated by one or more blank, tab,
        and/or newline character.  An exclusion specifier cannot be
        broken into two or more lines.  When a space character is
        embedded, the exclusion specifier must be surrounded by a
        pair of double-quotes (").  A line may contain a comment field
        which will be ignored by XXCOPY.  A comment field starts with
        two consecutive slashes (//) or two consecutive colons (::)
        and ends at the end of the line.  You may also use another
        comment style (starts with /* and ends with */ that can span
        over multiple lines).
    
    
    
    A few examples of common exclusion specifiers.
    
        The directory template may have the following four variations
        in the ending.
    
          dir_pattern\         // full directory
          dir_pattern\*\*      // full directory (same as above)
          dir_pattern\*        // files in the directory (one-level)
          dir_pattern\?*\      // all subdirectories but not files
    
          Even though the second example is to specify files (as opposed
          to directories) without the mandatory trailing backslash,
          it behaves exactly like the first one because it covers
          all files in all subdirectories which is equivalent to the
          whole directory contents that is the directory itself.
    
    
        Examples:
    
            /X:dirtmpl\*\*     // excludes all matching directories in the
                               // base (src) directory and its contents
            /X:dirtmpl\        // same as above (the triling backslash
                               // denotes everything inside the directory)
            /X:.\dirtmpl\      // in the case of the directory template,
                               // it applies to one directory relative to
                               // the base (src) directory (1-Level)
            /x:*\dirtmp\       // you may make a directory template apply
                               // to many instances (Multi-Level)
    
    
            /x:c:\windows\*    // specifies all the files in the first
                               // level of the c:\Windows directory such
                               // as, EXPLORER.EXE, WIN.INI,
    
            /x:c:\windows\?*\  // this does not includes the first level
                               // files but all subdirectories in it such
                               // as \WINDOWS\SYSTEM\  \WINDOWS\DESKTOP\, etc.
    
    
         Note that the following two are distinct:
    
             /Xdir_spec\*     // one layer only (subdirectories not excluded)
             /Xdir_spec\*\*   // the entire dir_spec directory is excluded
    
    
    The optimization of exclusion matching.
    
        In a very large scale backup operation, an XXCOPY job may encompass
        an entire volume as the source directory (such as c:\*).  To make
        the matters worse, the more files the source directory contains,
        the more the need for the exclusion specifiers grows.  Therefore,
        it is entirely possible that the entire C: drive may contain
        70,000 files and the total number of exclusion items the user specify
        in the exclusion list file with the /EX switch may contain literally
        hundreds of various exclusion specifiers.  If we were to test every
        file against this very large number of exclusion list, the combination
        will easily reach tens of millions which would slow down the entire
        backup process.  Therefore, XXCOPY performs preprocessing steps
        to analyze the set of exclusion specifiers.  First by classifying
        them into the five classes, some redundant exclusion specifiers can
        be removed.
    
    
    Debug feature
    
        Because a liberal use of wildcard characters in exclusion feature
        could become fairly complex, sometimes the user may want to test
        if a given set of exclusion items really achieve the intended
        result.
    
        The /oX switch generates a list of exclusion specifiers after
        XXCOPY's initial exclusion parameter optimization step.  The list
        is organized by the internal classification of the wildcard usage.
        It is most effective in combination with the /DEBUG function.
        (This output is mostly for Pixelab's support activities.)
    
        The /ZLX function provides a special test by listing all the files
        and directories that would be excluded without actually making any
        copy or delete operation.  It suppresses the display of regular
        (selected) files and generates a list of files and directories that
        would be excluded by the /X and /EX switches.  It is analogous to
        the /L function that lists the files that would be selected by
        a given set of command arguments.  
        
    
    Automatically excluded files.
    
        Since the few output files (e.g., the error log files) which are
        generated by the XXCOPY program itself could not be successfully
        included in the current copying job if any of them happens to be
        in the source directory (or its subdirectories), those files will
        be automatically excluded.
    
    
    Note on earlier (pre v.2.97.7) versions:
    
        In earlier versions of XXCOPY (prior to v.2.97.7), the exclusion
        feature was the hardest one to fully master by XXCOPY's users.
        That was because the exclusion specifier in earlier versions
        did not support the "Wild-Wildcard" capablitity to the fullest
        extent.  Rather, XXCOPY provided a total of 11 classes of wildcard
        usages with a complex set of syntactic rules.  So, the many users
        had to stick with a few simplest ways to add wildcard characters
        for the exclusion items.  It was simply very difficult to implement
        an efficent algorithm to support such a feature.
        
        In the old (pre-v.2.97.7) versions, the exclusion feature defined
        a special syntactic rule as follows:
        
              dir_pattern\?\*
      
        When an exclusion item with the \?\* ending, it excludes the
        subdirectories of the directories that matches the pattern.  The
        above exclusion pattern can be written as
    
             dir_pattern\?*\
        
        which does not rely on the special syntactic rule (which is now
        being abolished).
    
    
    Use of the /GX switch:
    
        In order to support the old syntax for the \?\* ending in the
        exclusion specifier, we have added the /GX switch with which
        a command line with the older exclusion specifier is treated
        in the old way.
        
        However, we urge all users to replace all usages of \?\* ending
        with \?*\ that excludes exactly the same group of subdirectories.
        
    
    

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

    XXCOPY TECHNICAL BULLETIN #06


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: File Attributes: what are they and how to use them.
    Date:    2000-01-17
    ====================================================================
    
    Since XXCOPY has features which interact with the file attributes,
    a discussion of XXCOPY cannot be complete without touching the basics
    of the file attributes.  This article presents the fundamentals of
    the file attributes and how XXCOPY manipulates them.  In addition,
    some common techniques with the file attributes are discussed.
    
    
    What are the file attributes?
    
      The operating systems (DOS, Win95/98, WinNT/2000/XP) maintain certain
      properties associated with every file and directories in addition to
      the file contents (data inside the file).  Such properties include
    
        file size in bytes
        file date/time (creation time, last-modify time, last-access time)
        file attributes
              archive bit   (shows that the file has not been archived yet)
              read-only bit (write-protect the file)
              directory bit (distinguishes a directory from a file)
              hidden bit    (hides from an ordinary directory listing)
              system bit    (denotes a system file whatever that means)
    
        These properties are mostly maintained by various components of
        the operating system and they are handled automatically.  So,
        the users may not be concerned with them.  However,  manipulating
        some of the properties are not very difficult and it can even be
        quite useful at times.  This article shows some common techniques
        associated with the file attributes.
    
        The file size is always determined by the actual size of the file
        and the only way to change it is to increase by appending more
        bytes to the existing file, or to decrease by overwriting with a
        shorter file.  The file date/time can be more easily changed.
        Since changing any of the three date/time values is supported by
        Win32 file I/O API, one can write a program to change them.  In fact,
        there are many utility programs available to do so.  Here, we will
        discuss the file attributes with greater details.
    
    
    What is the file attributes?
    
        Although one can say the file size and the file date/time are file
        attributes (i.e., any properties associated with a file other than
        the file contents), with the more narrow definition and popular
        usage, the file attributes are collection of flags stored as a bit
        mapped 32-bit quantity which describes various aspects of the file.
        The original MS-DOS file attributes had only 8 bits in the file
        attributes, the Win32 file attributes are stored as a 32-bit quantity.
    
        Although the exact bit positions of the file attributes are not
        officially guaranteed to remain the same by Microsoft, they will
        probably never be changed.
    
           Bit 0     Read-Only
           Bit 1     Hidden
           Bit 2     System
           Bit 3     Volume Label
           Bit 4     Directory
           Bit 5     Archive
    
        Bit 3 (Volume Label) was used in MS-DOS to store the volume label
        just like an ordinary file in the directory.  Bit 4 (Directory)
        distinguish a file from a directory.  These two bits cannot be
        modified easily.  But, the remaining four bits (bit 0, 1, 2, and 5)
        can be examined and/or modified by the ATTRIB.EXE utility which is
        supplied by DOS/Windows.
    
    
    The official Microsoft's way to manipulate the file attributes.
    
        Windows 95/98 provide a system utility program, ATTRIB.EXE which
        is usually stored in the C:\Windows\command\ directory.
    
        Here is the ATTRIB utility's command syntax
    
        ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] filespec [/S]
    
           +   Sets an attribute.
           -   Clears an attribute.
           R   Read-only file attribute.
           A   Archive file attribute.
           S   System file attribute.
           H   Hidden file attribute.
           /S  Processes files in all directories in the specified path.
    
        For example if you want to clear the Archive attribute bit of all
        the files in a directory, execute the following command line.
    
           ATTRIB  -A c:\mydir\*
    
    
    The Read-Only attribute.
    
        This bit is useful to make a file write-protected by software.
        For example, by setting the \AUTOEXEC.BAT file Read-only, you may
        protect the file from accidental deletion.  Or you may set a
        few files with the Read-only attributes and delete all the files
        using a "DEL *" (Delete all) command, the read only files will
        not be deleted under normal circumstances.  Certain files in the
        Win95/98 system are kept as Read-only by default (e.g., the system
        registry files).
    
        Before you can delete or overwrite a Read-only file, you must
        remove the Read-only file attribute bit.
    
        XXCOPY can force overwriting (or deletion) of a Read-only file by
        the /R switch.
    
    
    The Hidden and System attribute.
    
        The purpose of the Hidden attribute bit is to make the file
        invisible in certain applications' file list display.  Since many
        file applications has the feature to ignore the Hidden attribute
        bit, the file with the Hidden attribute bit is not always invisible.
    
        The System attribute bit is probably the least rigorously
        defined in its usage.  From the early days of MS-DOS, the System
        attribute bit has been used in inconsistent manners that the bit
        seldom has much meaning.  The DIR command treat the System
        attribute similarly to the Hidden bit for directory listing.
        But, the COPY command does not care whether a file has the System
        attribute or not for copying it (Interestingly the DIR and COPY
        commands are both "built-in" commands which is implemented within
        the COMMAND.COM program).
    
        In most Win95/98 systems, you will find about twenty files in the
        root directory which are marked both Hidden and System.  These two
        attributes are often go hand in hand.  But, the choice seems
        quite arbitrary.
    
        While the usage of the Hidden and the System attribute bits are
        not well defined, the presence (or absence) of these attribute
        bits seldom change the actions of most system utilities except for
        the DIR and COPY commands, in most case, removing the Hidden and
        System attributes on most files do not cause any harm (except
        maybe some layer of protection from accidental erasure).
    
        XXCOPY by default (/H0) ignores a file with either Hidden or System
        attribute.  With the /H switch, you may include files with the
        Hidden or the System attributes in XXCOPY's copy action.
    
    
    The Archive attribute.
    
        The Archive attribute was first introduced by MS-DOS version 2.0
        when the XCOPY utility was also created.  Therefore, the Archive
        attribute is probably best explained by how XCOPY handles the
        Archive attribute.  The purpose of the Archive attribute was clearly
        to quickly determine whether a file requires a back up (archiving).
    
        The Archive attribute is set whenever an existing file is either
        overwritten or modified (i.e., renamed or moved to another directory)
        by the file system.  A new file is usually created with the Archive
        attribute set.  The idea is to have a utility or application program
        to take the responsibility of clearing the Archive bit when a
        file is successfully backed up.  The next system backup operation
        will be made much more efficient by focusing only on the files with
        the Archive attribute bit set which are either newly created or
        modified in any way since all the Archive attributes are cleared the
        last time (i.e., the last backup time).
    
    
    Incremental Backup using the Archive attribute.
    
        When XCOPY was the only "officially" designated system archive utility
        in MS-DOS, the Archive attribute had its usefulness.  Or, if only
        one backup regime in the system manipulates the Archive attribute bit
        and no other programs modifies the bit, the scheme works well.
        However, there are many backup and archive utilities that are
        capable of clearing the Archive attribute.
    
        Unfortunately, the operating systems do not enforce this
        "only-one-program-can-modify-the-Archive-bit" policy.  Because of
        possible interference with other applications which might clear the
        Archive attribute, we consider that the incremental backup scheme
        based upon the Archive attribute too risky to depend upon.
    
        Therefore, we do not recommend the use of the /M switch to perform
        any system backup operation.  For an incremental backup,  XXCOPY's
        /BI switch performs similar function with more confidence by
        comparing the files in the source and the destination with regard
        to the file size AND file date/time.  If either of the two does not
        match (or the file does not exist in the destination), the file will
        be copied.  This method is nearly as efficient as looking at the
        Archive bit.
    
    
    Other usage of the Archive attribute.
    
        1.  You can determine which file(s) an application makes file
            changes (creation and modification) in a directory.  First,
            clear the Archive attribute of all the files in the given
            directory and run the application.  Then, check to see which
            files are marked by the Archive attribute.
    
            E.g.:  ATTRIB  -A c:\mydir\*       // clear the A bit first
                   Run your application next
                   XXCOPY  C:\mydir\*  /A/L    // list files with A bit set
    
        2.  Say, you have a directory with many files which you want to
            copy to a set of diskettes (one diskette cannot hold all of
            the files).  You can first set all the files with Archive
            attribute set first.  Then, run XXCOPY /M (or XCOPY /M).  The
            copy job will terminate as soon as the diskette becomes full.
            But the files which has already been copied are cleared of the
            Archive attribute.  So, run the same XXCOPY /M command again
            with a new diskette.  This time, the files which has been copied
            will be skipped.  Just repeat this operation until the files
            with Archive attribute run out.
    
            E.g.:  ATTRIB +A C:\mydir\*        // set the A bit set
                   XXCOPY C:\mydir\*  A:\ /M   // copy files with A bit
                   XXCOPY C:\mydir\*  A:\ /M   // repeat for next diskette
                     ...                       // continue until all files
                     ...                       // are copied.
    
    
    Full Backup using the Archive attribute.
    
        We have stated that the use of the Archive attribute is not suitable
        for a reliable incremental backup.   However, once we abandon the
        notion that the Archive attribute serves as a persistent marker, it
        becomes even more useful.  Yes, the Archive bit as a temporary marker
        can be quite convenient.  The example in the preceding section of
        directory-copy to a set of diskette is a backup in a small scale.
    
        When you run Microsoft's ATTRIBUTE utility,
    
            ATTRIB  +A  C:\*  /S
    
        You will encounter the following messages:
    
            Not resetting hidden file C:\WINDOWS\...
            ...
            Sharing violation reading drive C
            Abort, Retry, Fail?
    
        In this case, entering "F" should let you continue.  But, apparently,
        the ATTRIB utility treats the "Fail" option as "Abort".  This is
        provably a bug in the Microsoft program.
    
        Our XXCOPY behaves more predictably.
    
            XXCOPY  C:\*  /S /AA
    
        The /AA and /AZ switches make XXCOPY to perform the same function
        similar to the ATTRIB utility does except it does a better job.
        XXCOPY's /AA switch sets (/AZ clears) the Archive attribute bit
        including the hidden files (it has automatically set the /H switch
        to include hidden files) and handles share-violation gracefully.
        If you need speed, you may suppress the console output by /Q or /Q2.
    
            XXCOPY  C:\*  /S /AA /Q    ;shows only the files which changes
            XXCOPY  C:\*  /S /AA /Q2   ;shows only statistics at the end
    
        After setting the Archive attribute bit of all the files in the
        volume, you can start repeated backup using the /M switch
    
            XXCOPY  C:\*  T:\mybackup   /S /M /H ...
    
            (change the target media when it is full and try again)
    
        You may apply the same basic technique to a full-scale volume backup
        using the Archive attribute.  This is quite useful when you are
        backing up a large volume into smaller removable medium
        (e.g., CD-R, CD-RW, Tape-based file system, or even floppy disk).
    
        If you have an AutoLoader tape drive (e.g., HP SureStore 12000),
        a working batch file example based on this scheme is available at
        http://www.datman.com/tbul/dmtb_038.htm.
    
    
    List of XXCOPY's file attributes related switches.
    
        Archive bit
    
         /A0   Cancels *ALL* /A, /M, /AT, and /AX switches.
         /A    Excludes files without Archive bit set
         /AC   Ignores the Archive bit (always clears Archive bit)
         /M    Excludes files without Archive bit set (clears Archive bit)
         /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)
    
        Hidden and System bit
    
         /H0   Excludes files with Hidden or System Attributes bits (default)
         /Ho   Excludes files without Hidden or System Attributes bits.
         /H    Ignores the Hidden or System Attributes bits
    
        Destination Read Only bit
    
         /R0   Excludes a file when it exists in dst as read-only (default)
         /R    Allows overwrite/delete of a read-only file if necessary
    
        Destination file attributes
    
         /K0   Keeps H-bit and S-bit, sets A-bit, clears R-bit (default).
         /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 the A-bit)
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #07


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY's Handling the case of Cyclic Copy
    Date:    2004-12-18 (revised)
    ====================================================================
    
    What is a Cyclic Copy?
    
        Try this with Microsoft's XCOPY (not XXCOPY).
    
            XCOPY  C:\  C:\temp\ /S
    
        You will be greeted by the following message:
    
            Cannot perform a cyclic copy.
    
        A cyclic copy refers to the situation where the source directory
        contains the destination directory.  Since the destination directory
        is part of the source, the copying process eventually starts copying
        the destination directory to a deeper portion of the destination.
        This process will continue until, of course, the finite disk space
        eventually runs out.
    
        To avoid this condition but to achieve the objective, one can
        specify a temporary destination which is on another volume (e.g.,
        D:\temp\) and later copy the temporary destination to the final
        destination, and delete the temporary directory at the end.
    
    
    The safety net against a Cyclic Copy:
    
        Microsoft's XCOPY detects this disastrous situation with an error
        message.  With our XXCOPY, you may continue the normal file copy
        operation by excluding the directory that would be cyclic after
        a warning.
    
    
    Cases where a Cyclic Copy is useful:
    
        A Cyclic Copy is certainly useful with a combination with other
        switches such as /TR0 (create corresponding zero-byte files) or
        /T (make a directory tree without files).
    
        Or, you may be tempted to make a collection of certain data files
        into one directory:
    
            XXCOPY  C:\*.doc   c:\my_word\  /S
    
        Of course, it is senseless to let the recursive meltdown to occur
        by allowing the freshly copied files in the destination to partake
        in the copy process.  By now, it is quite apparent that what we
        really need is a mechanism to cut off this vicious cycle in the
        process.
    
    
    Enter XXCOPY's new switch for Cyclic Copy.
    
        XXCOPY comes with a few variations to handle the cyclic copy case.
    
        /CC     Warns you for a cyclic copy case and gives you a prompt
                where you may terminate the process immediately, or
                you may let XXCOPY continue by adding the destination
                directory in the exclusion list.
    
        /CCY    Continues the copy operation by automatically adding
                the destination directory in the exclusion list without
                prompting the user (as if you typed "Y" at the prompt).
    
        /CC0    Terminates the copy operation unconditionally without prompt.
                This is the old XCOPY behavior --- hardly useful but if
                you want to emulate XCOPY, you may do so with this switch.
    
    
    A few interesting examples taking advantage of the /CCY feature:
    
        XXCOPY  C:\*.doc  C:\my_word\  /CCY /S
    
               This example collects directories which contains .DOC
               files in the destination with the .DOC files.
    
        XXCOPY  C:\*.doc  C:\my_word\  /CCY /SX
    
               This is a variation of the fist example.  It uses XXCOPY's
               handy /SX switch.  It gathers all .DOC files from the entire
               volume and saves them in a flattened directory.  If you have
               little idea what a "flattened directory" is, just try it
               and examine the destination.  You will see what it is.
    
        XXCOPY  C:\  C:\skeleton\      /CCY /T
    
               This gives the whole volume tree (except the \skeleton
               itself) inside the destination without files.
    
        XXCOPY  C:\  C:\summary\       /CCY /E /TR0
    
               This one includes files without copying the file contents
               (creates zero-length files corresponding to the source).
    
    
        These operations are not possible using Microsoft's XCOPY.
        Incidentally, the explicit /CCY suppresses the warning message:
             
         "Detected a cyclic copy (the source includes the destination)."
    
    

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

    XXCOPY TECHNICAL BULLETIN #08


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Short names made by Win95/98 and by WinNT/2K/XP
    Date:    2003-10-14 (Revised)
    ====================================================================
    
    In our earlier article, XXTB #03, we discussed the subtle problem
    of long and short filenames commonly encountered by Windows users.
    The problem has been widely known and various solutions have been
    devised to handle most such cases.  XXCOPY can handle such cases
    correctly in most cases.
    
    Unfortunately, when you mix the two types of OS in operation, one
    more potential problem may arise.
    
    
    About the various Windows OS.
    
       Although all Windows operating systems except early ones (Win 3.x)
       support long filenames, there is a subtle difference in the
       algorithm of alias synthesis by the various OSes.  The difference
       may adversely affects XXCOPY's effort in preserving the short
       filename.
    
       First, let us examine the difference.  Windows 95 and 98 use a
       straightforward scheme in picking up the short name alia, whereas
       Windows NT4, NT5 and 2000 add a little twist in the way the numeric
       tail is generated.
    
       It is easy for anyone to observe the filename related idiosyncrasies.
       Just pick a file and repeatedly copy it in a directory under a series
       of long names having the same beginning.  For example:
    
            mkdir c:\temp
            copy  c:\autoexec.bat   c:\temp\mylongname1
            copy  c:\autoexec.bat   c:\temp\mylongname2
            copy  c:\autoexec.bat   c:\temp\mylongname3
            copy  c:\autoexec.bat   c:\temp\mylongname4
            copy  c:\autoexec.bat   c:\temp\mylongname5
            copy  c:\autoexec.bat   c:\temp\mylongname6
            copy  c:\autoexec.bat   c:\temp\mylongname7
            copy  c:\autoexec.bat   c:\temp\mylongname8
            copy  c:\autoexec.bat   c:\temp\mylongname9
    
       Then, using an appropriate tool, examine the destination directory.
       The following table shows the result of the copy operations in
       Windows 95/98 and the Windows NT/2000/XP variations.
    
            Longname         Windows 95/98/ME  Windows NT4/2K/XP
           ----------------------------------------------------------
            mylongname1          MYLONG~1          MYLONG~1
            mylongname2          MYLONG~2          MYLONG~2
            mylongname3          MYLONG~3          MYLONG~3
            mylongname4          MYLONG~4          MYLONG~4
            mylongname5          MYLONG~5          MYA476~1
            mylongname6          MYLONG~6          MYA486~1
            mylongname7          MYLONG~7          MYA496~1
            mylongname8          MYLONG~8          MYA4A6~1
            mylongname9          MYLONG~9          MYA4B6~1
    
       Whereas the Win9x OSes use a simple decimal number in the numeric
       tail, the WinNT family OSes follow the same pattern only in the
       first four cases.  After that, they start using a 4-digit
       hexadecimal number in the middle of the 8.3 name as the
       distinguishing part (only the first two letters remains the same).
    
       The hexadecimal value is probably a hash value for the string to
       supposedly shorten the filename matching operation which could be
       very time consuming.  Microsoft programmers chose to keep the first
       four match done numerically for the sake of compatibility to the
       Win9X systems.  What they failed to realize is that they allowed
       only the first four such names for compatibility.
    
    
    The adverse effect of the two alias algorithms.
    
       As long as you use XXCOPY in a homogeneous environment where
       the files are generated under one OS, XXCOPY can preserve the
       short name.  But, when you have a mixed environment (e.g., with a
       dual-boot system), you may copy a directory with many similar
       names which were created under one OS and then perform a directory
       copy operation using XXCOPY under the other OS, XXCOPY may not be
       able to preserve the short name.
    
       One consolation is that the great majority of files will receive
       the correct short name alias using XXCOPY since the numeric tail of
       the first four aliases in a directory are common in all Windows OSes.
       Therefore the problem should be quite rare.  Ironically, if your
       system has many Microsoft software packages, you will find quite
       a few directories which all start like:
    
         "\Program Files\Microsoft xxxxx"
    
       One can argue that exactly because it is so rare, this phenomenon
       would not be widely known.  Therefore, when the rare problem occurs,
       it will take many agonizing hours for the user to discover the
       cause of the problem.
    
    
    Then, what happens with XXCOPY?
    
       Since XXCOPY does not access the raw directory contents in the
       process of preserving the short name alias, its magic does not work
       all the time.  We cannot do much about this problem without making
       the XXCOPY utility breaking the rules of good programming practice.
       At least we can list the situations where the potential problem may
       arise and how you can it.
    
       1.  Stay within the 8.3 naming convention if possible.
       2.  Stay away from a dual-boot system if possible.
       3.  If you have a dual-boot system and you switch the OS from
           time to time, make sure a directory is written exclusively
           under one OS if possible.
       4.  Finally, when you have to copy a directory, use XXCOPY and
           perform the copy operation under the same OS in which the
           files in the directory were created.
       5.  In a networked environment with different types of OS between
           the source and the destination directories, expect the worst.
    
       Note that although it is ideal that when you copy a directory,
       all the files in the destination should be identical to those in
       the source, in most case, it is not the end of the world.  As a
       matter of fact, in most cases, the discrepancies in short names
       do not cause any problem.  As long as the files and directories
       that are affected by this problem is "non-system" files, the
       problem would be benign if present at all.
    
       In the case of Windows 95/98, the most well documented problem
       which are associated with the unmatched short name is a few
       directory and filenames which are stored in their short name
       alias in a few critical cases in the system registry.  Since
       Windows 95/98 references these files at the system initialization
       time (locating and loading VxD files using short names), the
       difference would be life and death (that is, success and failure
       in system initialization).
    
    
    A final advice with XXCOPY:
    
       If you have a large number of collided aliases (where the short
       name distinctions are made by the synthesized numeric tail only),
       and you are copying across OSes (from Win95/98 to WinNT/2000/XP
       or vice versa), we suggest you turn off XXCOPY's short name
       preservation switch by /NX0 in order to avoid the time consuming
       and futile effort by XXCOPY.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #09


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Worldwide Network of Download Sites for XXCOPY
    Date:    2001-07-10
    ====================================================================
    
    If you have difficulties downloading the XXCOPY freeware copy
    from our own server, select an ftp site which is close to you.
    
    Our sincere thanks go to Simtel.Net which has the world-wide
    network of mirror sites.
    
    Unfortunately, due to the agreement with Simtel.Net we are unable
    to provide direct links to the files.  You should visit the
    following page which has the actuali links of the mirror sites:
    
    
       Simtel.Net List of Mrror sites
    
    
    
    XXCOPY Freeware ver 2.60.0  (xxfw2600.zip)
    
    
    FTP:// download sites
    ________________________________________________________________________
    
    US, ALL (primary)        US, Arizona              US, Georgia 
    
    US, Illinois             US, Indiana              US, Massachusetts
    
    US, Missouri             US, New York             US, Oklahoma
    
    US, Oregon               US, Pennsylvania         US, Virginia
    
    
    
    Australia                Austria                  Belgium
    
    Brazil                   Bulgaria                 Canada
    
    Czech Republic           Denmark                  Finland
    
    France                   Germany                  Hong Kong
    
    Hungary                  Italy                    Japan
    
    Netherlands              Norway                   Poland
    
    Portugal                 Russia                   Singapore 
    
    Slovenia                 South Africa             South Korea 
    
    Spain                    Sweden                   Switzerland 
    
    Thailand                 Turkey                   UK
    
    
    
    HTTP:// download sites ________________________________________________________________________ US, Arizona US, Minnesota US, California US, Indiana US, New York Australia Austria Brazil Denmark Finland Germany Japan Norway Portugal Russia South Africa Spain UK

    XXCLONE
    [ Back to Table of Contents ] [ << ] [ >> ]

    XXCOPY TECHNICAL BULLETIN #10


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Cloning the Win9x system disk using XXCOPY.
    Date:    2003-11-07  (revised)
    ====================================================================
    
    The disk clone operation has become one of the most popular usages of
    the XXCOPY utility.  Therefore, I decided to have this dedicated
    page just for the subject.  But, if you just arrived at this page
    for the first time and have not really learned much about XXCOPY,
    I would like to remind you that this Disk Clone capability is rather
    a small portion of what XXCOPY can do for you.  If you are in a hurry,
    go ahead and finish your disk clone job by following the instructions
    below.  But, I suggest you come back and explore the rest of XXCOPY.
    
    In this article, I would like to discuss the most common case of
    disk cloning operation.  Some related topics which were once part
    of this article are moved to another page, XXTB #20.
    
    Note:  The technique discussed in this article applies primarily
           for Windows 9x and ME cases.  If your C: drive is loaded
           with Win NT4/2000/XP, you will not get a bootable disk.  If you
           have a dual-boot system (Win 9X and NT/2000/XP), then it is best
           you perform the operation from Win 9x.  But even in that case,
           the newly cloned drive will not be dual-bootable because XXCOPY
           does not touch the Master Boot Record (MBR) of a hard disk
           (we believe it should be handled by FDISK or other tools).
    
           As of this writing, we do not have a simple solution to reliably
           produce a bootable system disk for an NT4/2000/XP system using
           the XXCOPY utility.
    
    
    System Disk Cloning:
    
        Say, you bought a hard disk with an astronomical number of bytes
        (at least, it seems that way for now), and you want to install
        your new drive as your system disk (Drive C:).
    
        Typically, you would connect the brand new drive to the EIDE
        port (either as the primary port's slave or the secondary port's
        master or slave --- whichever is available on your computer).
        Most new disk drives have the jumper setting printed on the top
        cover of the drive (the selection involves only master/slave).
    
        The overall procedure goes like this:  first, you connect the
        new drive and assign a temporary drive letter to it.  Then, copy
        the contents of the current Drive C: to the new drive's volume.
        Usually, the new drive has more capacity than the old one.
        Therefore, you can copy the entire C: drive to the new drive
        and still you will have much free space.  After the files are
        copied from the old drive to the new one, you will remove the
        old drive and place the new one as Drive C:.  It is quite
        straightforward.  Here, I assume your new drive will be
        temporarily assigned as Drive D:.
    
        Summarizing this, the sequence is as follows:
    
           . connect the new drive as D:
           . FDISK                         (initialize a partition)
           . FORMAT D:                     (init volume for file access)
           . XXCOPY C:\ D:\  /CLONE        (copy all the files)
           . connect the new drive as C:
           . FDISK                         (set active partition)
    
    
    
    Step-by-Step Instructions:
    
        Now, let me go over the sequence, step-by-step with more details.
        If you have a printer, you may make a hard copy which will be
        handy for a beginner.
    
        In this article, the main drive is assumed to be C: and the
        Windows directory is located at C:\Windows.  If your settings
        are different, make necessary adjustments in the commands shown
        in this article.
    
             -----------------------------------------------------------
               How to create a DOS Box
    
                  XXCOPY is a console application which is most
                  conveniently launched from a DOS Box in Win9x.
    
                  If you don't have an icon handy for DOS Box on desktop,
                  you may create one by Right-click at an empty point in
                  the desktop and click New > Shortcut.  Then, type in
                  the box labeld Command line [ command.com ] and
                  click [ Next ] and then click [ Finish ].
                  Now, you will find an icon labeld "MS-DOS Prompt".
    
                  Or, you may create a DOS Box directly by starting
                  at the taskbar, click [ Start ] and click [ Run...].
                  Then type in the box labeld Open [ command.com ] and
                  click [ OK ].
             -----------------------------------------------------------
    
    
        0. Clean up the system disk
    
           Before you start the disk cloning operation, it is best if
           you clean up the original disk.  It is highly recommended
           that you run the SCANDISK utility.  Since some long-named
           files/directories are not reachable in DOS, you should run
           SCANDISK in the Win32 environment (the regular Windows 9X/NT/2K).
    
           Perform any additional cleaning up on the drive to remove
           garbage files which include the files generated by SCANDISK
           for retrieved data (check the root directory for names like
           FILE0000.CHK).  This is an ideal time to throw away other
           junk.  Don't forget to empty the Recycle Bin at the end.
    
    
        1. Making the system diskette
    
           The next hard disk preparation steps (FDISK and FORMAT) may
           be carried out either in a DOS box of Windows or in the
           real-mode DOS.  Since you need to boot the system from a
           diskette at least once (to run FDISK), it is usually faster
           if you perform the initial FDISK and FORMAT operations in
           the real-mode (DOS) environment created by the system diskette.
    
           If you have a Win9x boot diskette, you may skip this step.
           But, the boot diskette which you create using this method
           will take considerably less time to initialize the DOS
           environment (without the access to the CD-ROM but you don't
           need CD-ROM for this) than with the Win9x boot diskette.
    
           In a DOS Box, run the following commands to prepare a system
           diskette for the bootup, FDISK and FORMAT operations.
    
               FORMAT A: /S
               COPY  C:\WINDOWS\COMMAND\FDISK.EXE   A:\
               COPY  C:\WINDOWS\COMMAND\FORMAT.COM  A:\
               COPY  C:\WINDOWS\COMMAND\SYS.COM     A:\
    
           -------------------------------------------------------------
           Note:  In Windows ME, you have to run the "FORMAT" command
                  without the /S switch which is no longer supported.
                  Therefore, you need to run the following commands by
                  hand from a DOS Box to achieve the same result.
    
                      FORMAT A:
                      COPY    C:\WINDOWS\COMMAND\EBD\IO.SYS      A:\
                      COPY    C:\WINDOWS\COMMAND\EBD\COMMAND.COM A:\
                      COPY    C:\WINDOWS\COMMAND\FDISK.EXE       A:\ 
                      COPY    C:\WINDOWS\COMMAND\FORMAT.COM      A:\ 
                      COPY    C:\WINDOWS\COMMAND\SYS.COM         A:\ 
           -------------------------------------------------------------
    
           Since you have plenty of room in the diskette, you may
           copy a few basic tools (we do not use any of them in this
           procedure).  If you don't know how to use them, skip this.
    
                EDIT.COM        (or your favorite text editor)
                XXCOPY16.EXE
                HIMEM.SYS
                SMARTDRV.EXE
                DOSKEY.COM
                ATTRIB.EXE
                DELTREE.EXE
    
    
        2. Attach the new disk as Drive D:
    
           Once you have a system diskette which can boot up the
           system, you can shut down the system now.
    
           If you have  not attached the new disk drive, now is
           the time to connect it as a non-boot disk by leaving
           the current system disk (Drive C:) as it is.  We assume
           your new drive is the 2nd drive (referred to as
           Drive 2 by FDISK).
    
           There is an well-written site which shows this step with
           good illustrations at Adding a 2nd Hard Drive.
    
    
        3. Initialize the new disk partition (FDISK)
    
           Power up the system and boot up using the system diskette.
           From the command prompt of DOS, run FDISK.EXE by typing:
    
               FDISK
    
           After confirming that you go along with the "Large Disk Support",
           Select choice 5 (Change current fixed disk drive), and enter
           the correct "Disk Drive Number".  After making the new drive
           the current disk drive, select choice 1 (Create DOS partition
           or Logical DOS Drive).  You now specify the space you allocate
           for the new partition (most people select 100%).  Exit FDISK.
    
    
        4. Initialize the new volume (FORMAT)
    
           After the new drive's partition is intialized by FDISK,
           reboot the system using the system diskette which you made in
           Step 1.  The next step is to format the new partition which
           can be done either in Windows' DOS Box or in the real DOS.  But,
           here we choose to boot up the system using the newly created
           diskette since it verifies that the diskette really works
           before we remove the current bootable hard disk.  Also, it
           is a bit faster.
           
           The diskette-reboot will lead you to a DOS prompt at A:\>.
    
           Before formatting the disk, you should check if the drive
           letter is right (you don't want to format the other drive).
    
               DIR D:
    
           The system should complain by saying:
    
               Invalid media type reading drive D
               Abort, Retry, Fail?
    
           This is exactly what you want with the partition which was
           just initialized by FDISK, but has not been formatted.  If you
           see any other message, you should run FDISK, select 5
           (Change current fixed disk drive) in the main menu, and
           examine the overview of the disk partitions.  The listing
           conveniently displays both the disk number (1, 2, etc.)
           and the drive letter assigned to the various partitions.
           Type ESC a few times to exit the FDISK utility.
    
           Once you are sure of the drive letter, run the next command.
    
               FORMAT D:
    
           This time, it may take some time (depending on the capacity
           of the drive) while the sectors are verified for read/write
           operations.  Before the FORMAT command finishes its job,
           it will prompt you to enter the volume name.  You may enter
           any name (up to 11 characters).  I urge you to name it
           something rather than leaving it blank.
    
           Once the volume is formatted, you may access the drive now.
           Just type the following command in a DOS Box.
    
               DIR D:
    
            If you see lines like this, then it is good.
    
                  Volume in drive D is XXXXXXXXX
                  Volume Serial Number is 1234-5678
                  Directory of D:\
                  ...
    
    
        5. Reboot after format (back to Windows 9x)
    
           Although it is possible to enter Windows from this
           environment (provided that you installed HIMEM.SYS),
           we do not recommend doing so at this point.  Remove
           the system diskette from the floppy drive and reboot
           the system and enter the regular Windows environment.
    
              -----------------------------------------------------
               If you were preparing the new partition inside a
               DOS Box, rather than in real-mode DOS, you could
               access the volume and proceed to the next step
               (XXCOPY /CLONE), but you should still reboot now.
               Because after a volume is formatted, it remains
               in the so-called "MS-DOS compatibility mode" where
               the disk I/O cache is disabled.  Without a reboot
               after a format, file access to the volume will be
               extremely slow --- the XXCOPY action would take
               literally hours rather than minutes without reboot!
              -----------------------------------------------------
    
    
        6. Duplicate the volume (XXCOPY /CLONE)
    
           Once you have prepared the new disk with FDISK and FORMAT,
           you are ready to run the centerpiece of this procedure.
           This step is the most important operation in the entire
           procedure.  You must be in the Win32 environment, that is
           you must enter the Windows' GUI world (not booting into
           the "Command Prompt Only" (real mode, DOS) environment.
           Then, open up a DOS Box.  When you have followed the standard
           XXCOPY installation procedure, XXCOPY.EXE should be present at
           the \Windows\command directory so that XXCOPY is the "path".
    
           Run the following command from a DOS Box.
    
               XXCOPY  C:\  D:\  /CLONE
    
              ----------------------------------------------------------
               The /CLONE switch looks deceptively simple. But,
               it is actually a combination of eight distinct
               switches.  Much of XXCOPY's flexibility comes from
               combining a variety of switches.  This particular
               case is equivalent to the following command.
    
                 XXCOPY  C:\  D:\  /ks/h/e/r/q/y/bi/zy/ze
    
                   Explanation:
    
                   /ks ; keeps source files' attributes exactly
                   /h  ; copies hidden and system files
                   /e  ; copies subdirectories (including empty ones)
                   /r  ; overwrites read-only files if such files exist
                   /q  ; suppresses display of skipped file in backup
                   /y  ; overwrites existing files without prompt
                   /bi ; backs up incrementally (skips identical files)
                   /zy ; deletes extra files in destination if present
                   /ze ; disables XXCOPY's use of Envrionment variables
              ----------------------------------------------------------
    
           The XXCOPY operation takes anywhere from 10 minutes to
           over several hours, depending on the amount of data you
           transfer (typically 2-15 GB/hr)..
    
    
        7. While XXCOPY /CLONE is in progress...
    
           When XXCOPY is carrying out the clone operation, you don't
           have to sit idle.  You may actively use the computer as
           usual, browsing the Web, operate a word processor, or use
           spreadsheet --- whatever.  Just consider the on-going
           XXCOPY operation a background task.  There may be a few
           files which may not be copied the first time due to
           file-access contention.  That is expected and not a serious
           problem at all.
    
           Once the first round of XXCOPY /CLONE operation is over,
           finish your foreground work, close all active programs
           at this point.  Then, run the exactly same command again.
    
               XXCOPY  C:\  D:\  /CLONE
    
           The key here is that the /CLONE operation behaves as an
           incremental backup (by the virtue of the /BI component).
           It compares the source volume and the destination volume
           and skips files which already exist in the destination
           with the same size and time.  The second /CLONE step
           should take only a few minutes at most.
    
           You may still observe a few failed copies.  The most
           notable one in the Win9x system is the virtual memory
           swap file (WIN386.SWP).  In the case of Win NT4 and
           Win 2000, the equivalent file is named PAGEFILE.SYS.
           It is safe to ignore these swap files.
    
           You may run the /CLONE command as many times as you like:
    
               XXCOPY  C:\  D:\  /CLONE
    
    
        8. After XXCOPY /CLONE is complete.
    
           When the entire volume has been copied by XXCOPY, you are
           ready to remove the old Drive C: and connect the new drive
           as your new Drive C:.  Shut down your Win9x system now,
           and reconfigure your hard disks. You may need to remove
           the jumper plug which made it a slave drive.  You may also
           need to adjust the BIOS setting (Primary/Secondary IDE,
           Master/Slave drive parameters).  All recent models of
           motherboard come with a BIOS which has the AUTO sense mode
           which is trouble-free.  If you select a manual setting,
           you may need to adjust the hard disk paramters.
    
    
        9. Make the new partition "Active" (FDISK).
    
           Since the new drive is still not bootable, but it has to
           be connected as Drive C: since FDISK can activate only the
           first disk drive's (Drive C) Primary DOS Partition.  So,
           we need the system diskette once more to boot the system.
    
           Now, the remaining thing is to make the new drive bootable.
           The Master Boot Record (MBR) must contain the partition table
           where the Primary DOS partition is set "Active".
    
               FDISK
    
           Select choice 2 in the first FDISK menu (Set active partition).
           When you display Partition Information by choice 4, the main
           partition should show Status 'A' (for Active partition).
           Pressing the ESC key will terminate the FDISK utility.
    
       10. Make the new drive bootable (FDISK).
    
           The normal FDISK operation you have just performed modifies
           the contents of the partition table in the first logical
           sector of the drive (MBR).  But, the operation does not
           change the section of the MBR which contains the bootstrap
           program (a very small machine-language program which will
           receive control of the system at the very beginning of the
           system bootup process).  FDISK has a "well known" undocumented
           feature which initializes the bootstrap program inside the MBR.
           Run the following command line.
           
               FDISK /MBR 
    
           Unlike the regular interactive FDISK operation, with the
           /MBR switch, it quietly carries out the MBR-initialization
           operation.  As a matter of fact, it does not say anything.
           If you are a bit nervous, visit the following Microsoft site:
           
             Q69013: FISK /MBR Rewrites the Master Boot Record.
    
           Microsoft documents this feature in the article and yet it
           calls this feature "undocumented" in the article itself!!!
           So, I guess it remains undocumented...  
    
       11. Boot to the Windows (DONE)
    
           Remove the system diskette from the floppy drive and
           let the system boot from the new Drive C: to windows.
           You may just leave the original system disk (now as D:)
           for daily backup storage.  If you set up a well written
           backup batch file script (using XXCOPY of course), you
           may use a much smaller disk drive for system drive
           backup.
    
       12. If the new disk has a difficulty in booting up by itself,
           consider running the SYS command.  If you follow all of the
           steps described above, you need not run the SYS command.
           However, if you skipped the format step, the boot sector
           may not have proper boot code.  Or, if your procedure
           is slightly deviated from the above steps in any way, the
           boot sector may not have been properly initialized.  At any
           event, it does not hurt to run this step.  From the DOS
           prompt using the system disktte, run the following command:
           
               SYS  A:  C:
               
           This procedure copies IO.SYS, MSDOS.SYS, and COMMAND.COM
           from the diskette to the root directory of the C: drive
           (which is not necessary) and also re-initializes the
           boot sector of the C: drive.  (The boot sector is usually
           initialized when the volume is formatted.)  Now, you can
           try rebooting from the hard disk.
    
      ================================================================
    
    
    Q and A about Disk Cloning:
    
      Q:  Can I stay in DOS (real mode) to duplicate the disk using
          XXCOPY16?
    
      A:  We strongly recommend the use of XXCOPY.EXE (the 32-bit
          version which must run under the Win32 environment), as
          described in this page.  When you stay in the DOS (real mode)
          environment, you may not be able to access all the files and
          directories in your disk drive.  This is due to the fact that
          the DOS environment cannot handle a pathname which exceeds
          the 80 character limit.  Although each long name comes with
          its short name (8.3 format) alias, there could still be a
          heavily nested, very long path which exceeds the 80-character
          limit after converting all of the long directory names into
          their short name alias (for the same reason, SCANDISK fails
          on certain volume in 16-bit mode).
    
          If all of the files in your drive have a full pathname less
          than 80 characters, you can use XXCOPY16 with the /CLONE switch
          to create an interim copy of the source disk which can be made
          bootable.  After you boot into the Win9x environment, you
          should convert all of the shortnames in your system disk
          into the corresponding longname using the following command
          (assuming the D: drive is the original source drive)
    
             XXCOPY D:\  C:\  /S  /NL
    
          This procedure lets you restore most of the long filenames.
          However, there will be a small number of files and directories
          which are made prior to this XXCOPY run (immediately after the
          first Win9x initialization).  That is, you need to perform
          additional procedures by hand to make necessary adjustments.
          In short, this procedure is troublesome at best and we don't
          recommend it to anyone who asks this question in the first place.
    
    
      Q:  I thought you need to use the /S option when you format the
          new hard disk in disk in order to make the drive bootable.
          Why?
    
      A:  It is true that you should take advantage of the /S switch
          when you make the boot diskette as
    
              FORMAT A: /S
    
          The bare FORMAT command formats the media (which tests the
          sectors and initializes the FAT and the root directory).
          With the /S switch, it performs additional file copy
          operation. (COMMAND.COM, IO.SYS, MSDOS.SYS, and DRVSPACE.BIN).
          Since the XXCOPY /CLONE procedure copies these system files
          anyway (provided that the source volume contains these files),
          it is redundant to run "FORMAT D:"  with the /S switch when
          you initialize the new hard disk (it does not hurt though).
    
    
      Q:  I did not find the "SYS" command in the sequence you showed.
          Why can you skip this step?
    
      A:  The SYS command performs the equivalent of the "/S" switch
          in the FORMAT command.  For the same reason mentioned above,
          you can skip the SYS command when you run XXCOPY /CLONE.
          Some people believe that the SYS command initializes the
          MBR (see below) to make the drive bootable.  This is not
          correct.  The MBR is usually managed by FDISK. Not by
          FORMAT or SYS utilities.  (Also, see Step 12.)
    
    
      Q:  In which steps does the Master Boot Record (MBR) of the new
          drive initialized?
    
      A:  If you follow the step-by-step instructions described in
          this page, you should notice that you use the FDISK utility
          three times.  The first time, you will initialize the primary
          partition of the new drive.  At that time, the drive is
          tentatively assigned as a non-bootable drive (e.g., D:).
          Unfortunately, FDISK does not allow you to make the primary
          DOS partition of the new disk "Active".  For some reason,
          FDISK sets only the first drive's (C:) primary partition
          "active".  That is why in the above procedure, you need to
          boot up the system using the boot diskette.  In your second
          invocation of FDISK, you make the primary DOS partition
          "Active".  Then, the the third time with the FDISK /MBR
          switch, the bootstrap section of the MBR is initalized.
    
    
      Q:  Can you write (or read)  the MBR using XXCOPY?
    
      A:  No.  XXCOPY does *NOT* touch the MBR block which is the
          very first logical sector of the volume.  It contains both
          the partition information and the system initialization
          code (a very tightly written machine language program).
          We strongly believe that a "well-behaving" program such
          as XXCOPY must not touch the area of the disk which is
          handled by specialized tools.  In this case, FDISk is the
          official utility whose only job is to manage the contents
          of MBR.  Microsoft's utilities FDISK and FORMAT have never
          been combined to be just one simple utility for this very
          reason.  In the future we may make add a MBR backup
          feature.  But, it is a dangerous operation at best.
          Of course, we all know how bad Microsoft's FDISK design is.
          But, it gets the job done..
    
    
      For more on cloning, see XXTB #20.
    
      Click the download file (the line below) when you are ready.
    
         http://www.xxcopy.com/download/xxfw2979.zip
    
     [ This page may be accessed by its alias, http://www.xxcopy.com/clone ]
    
    

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

    XXCOPY TECHNICAL BULLETIN #11


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY Cookbook: Recipes of common usages
    Date:    2001-03-03
    ====================================================================
    
    A few examples are often more useful than pages of rigorous and
    boring definitions and reference material.
    
    --------------------------------------------------------------------
    Select files that are made on or after February 1st, 2000.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DA:2000-02-01
    
    
    --------------------------------------------------------------------
    Select files that are made before January 1st, 2000.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB:1999-12-31
    
        Note: The date for /DA and /DB is inclusive of the date.
    
    
    --------------------------------------------------------------------
    Select files that are made today.
    
      XXCOPY  c:\src\  c:\temp\   /Do:. /S
    
        Note: /DB:.  selects files of yesterday or earlier
              /DA:.  selects files of today (and with future dates)
             (see below for a variation)
    
    
    --------------------------------------------------------------------
    Select all the files in the entire volume which are made today
    
      XXCOPY  c:\    c:\temp\   /Do:. /S /CCY
    
        Note: this is a case of cyclic copy situation where the
              destination is a part of the source directory (the root),
              which requires the /CC switch to avoid a recursive meltdown.
              Here, /CCY (with the Y at the end) suppresses the warning
              message for the case.
    
      XXCOPY  c:\    c:\temp\   /Do:. /SX /CCY
    
              This variation (with /SX) creates a flat list of files
              in the \temp directory.  By substituting the subdirectory
              delimiter character (backslash) by another character,
              the files in the destination are easily examined.
    
    
    --------------------------------------------------------------------
    Select files that are modified (or newly created) today (or after).
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DA:.
      XXCOPY  c:\srcdir\  d:\dstdir\  /DA#.
      XXCOPY  c:\srcdir\  d:\dstdir\  /DA#0
    
        All of the above will give you exactly the same result.
    
        Note: the single dot "." is a shortcut for TODAY's date
              when used with the "After" prefix.
    
        Although in most system, you seldom find a file with a future
        date, the operating system does not prohibit a program from
        setting any legal time.
    
    
    --------------------------------------------------------------------
    Select files that are created today (or after).
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /FC/DA:.
      XXCOPY  c:\srcdir\  d:\dstdir\  /FC/DA#.
      XXCOPY  c:\srcdir\  d:\dstdir\  /FC/DA#0
    
    
        All of the above will give you exactly the same result.
    
        Note: the single dot "." is a shortcut for TODAY's date
              when used with the "After" prefix.
    
        Although in most system, you seldom find files dates which
        are "newer" than the current time, the operating system does
        not prohibit a program from setting file time as such.
    
    
    --------------------------------------------------------------------
    Select files that are made within the past 45 minutes.
    
      XXCOPY  c:\src\  c:\temp\   /S  /DA#30M
    
        Note: /DA#30M   The age parameter after /DA# (or /DB#) may be
                        appended with a suffix (D, H, M, or S for Days,
    
        Variations:
        
              /DA#10      10 days (Days if no suffix)
              /DA#365D   365 days
              /DA#90M     90 minutes (1 hr 30 min)
              /DA#330S   330 seconds (5 min 30 sec).
              /DB#36H     46 hours or before
    
    
    --------------------------------------------------------------------
    
    Select files that are made on or before yesterday.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB:.
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB#.
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB#1
    
        All of the above will give you exactly the same result.
    
        Note: the single dot "." is a shortcut for YESTERDAY's date
              when used with the "Before" prefix.
    
     Caution: The meaning of the dot "." character used in conjunction
              with the "B(efore)" prefix is different from that with
              the "A(fter)".  That is because "On-or-Before-Today" is
              hardly ever used and there is no use to designate a
              special shortcut for it.  On the other hand, the number
              of days specified with the "#" prefix always counts the
              days from today (which is designated by #0).
    
    --------------------------------------------------------------------
    Select files that are older than 30 days.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB#31
    
        Note: /DB#30  would include the 30th day.
    
    
    --------------------------------------------------------------------
    Select files that are 30-60 days old.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB#30 /DA#60
    
    
    --------------------------------------------------------------------
    Select files that are *NOT* 30-60 days old.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DA#29 /DB#61
    
    
    --------------------------------------------------------------------
    Select files that are 6-12 hours old.
    
      XXCOPY  c:\srcdir\  d:\dstdir\  /DB#6H /DA#12H
    
    
    --------------------------------------------------------------------
    Copy files and remove extra files in the destination
    
      XXCOPY \src\  \dst\  /Z
    
        The /Z switch remove all files in the destination whose
        counterpart is not present in the source.  In this most
        primitive form, the /Z switch itself does not check whether
        the remaining files are the same or not.  But, in this
        particular case, all files in the \src directory will be
        copied to the \dst directory.  If the file to be copied to
        the destination is brand new (no file with the same name
        exists in the destination), then the file will be copied
        quietly.  The file that exists in the destination will give
        you a warning for overwrite (Yes/No/All).  If you say No,
        then, the old file will be left alone --- possibly causing
        some mismatch in file.  You may automate this command by
        adding /Y which is equivalent of typing 'Y' to all prompts.
        But, for each extra file to be deleted from the destination,
        XXCOPY will give you another warning with Yes/No/All prompt.
    
      XXCOPY \src\  \dst\  /Y /ZY
    
        This variation suppresses the two types of warning prompts.
        But, in order to make the two directories really the same,
        a number of additional consideration must be made.
    
        1. hidden and system files are not included in a normal copy.
        2. subdirectories in the directory should be included.
        3. you may want to preserve the file attributes exactly.
        4. a read-only file in destination would prevent an overwrite.
    
        So, you need a combination of more switches to really make
        two directory the same (see below).
    
      Caution:
    
        The /CLONE, /Z, and /ZY switch performs deletion of extra
        directories and files in the destination.  If you inadvertently
        specify a wrong destination, the consequence will be very
        severe.  Some careless users have lost many files by this!!!
    
    
    --------------------------------------------------------------------
    Variations in directory synchronization to F: (e.g., a Zip disk).
    
      XXCOPY  "C:\My Documents\" F:\        /KS/H/E/R/Q/Y/BI/ZY
    
        This example is the standard way to duplicate the source
        directory at the destination.
    
          /KS    Keeps the file attributes of the source exactly
          /H     Includes hidden and/or system files
          /E     Copies subdirectories including empty ones
          /R     Overwrites existing files that are read-only
          /Q     Suppresses display for skipped files
          /Y     Suppresses the Y/N/A prompt for a file overwrite
          /BI    Backs up incrementally (skips file with same size/time)
          /ZY    Deletes extra files in destination (without Y/N prompt)
    
          Note that the first argument was surrounded by a pair of
          double-quotes (").  This was necessitated by the presence of
          embedded space (between My and Documents).
    
      Caution:
    
        The /CLONE, /Z, and /ZY switch performs deletion of extra
        directories and files in the destination.  If you inadvertently
        specify a wrong destination, the consequence will be very
        severe.  Some careless users have lost many files by this!!!
    
    
      XXCOPY  "C:\My Documents\" F:\        /CLONE
    
        The /CLONE switch is equivalent to typing the /KS/H/E/R/Q/Y/BI/ZY
        combination.
    
      XXCOPY  "C:\My Documents\" F:\MYDOC   /CLONE/I
      XXCOPY  "C:\My Documents\" F:\MYDOC\  /CLONE
    
        These variations show the use of subdirectory in the destination.
        The /I switch or the trailing backslash in the destination name
        suppresses a possible Y/N prompt in case the destination
        directory does not exist.
    
        When you use a removable media (e.g., a diskette, or Zip disk),
        you should just reverse the action on the target system.
    
      XXCOPY  F:\   "C:\My Documents\"      /CLONE
    
        In this example, any extra files that exists on the target
        system will be deleted.  If you do not want to delete any of
        existing files (or directories), you should do the following:
    
      XXCOPY  F:\   "C:\My Documents\"      /CLONE /Z0
    
        The /Z0 switch after /CLONE will negate the /ZY switch which
        is declared within the super /CLONE switch.  This command
        will leave any additional files and directory in the destination
        untouched.
    
        Note that if any opposing or mutually exclusive switches exist
        on a command line, they are interpreted from left to right.
        Therefore, if you place /Z0 before /CLONE, the effect of /Z0
        will be lost.
    
    
    --------------------------------------------------------------------
    Cloning a DOS/Win9x drive to another
    
      XXCOPY  C:\  D:\     /CLONE
    
        Cannot be simpler than this!!!  The above section scrutinizes
        exact meaning of /CLONE in terms of its true switch components.
        This command is repeatable (first time, you run this command
        in background while you continue using the system).  While you
        are running this command, you may type a Ctrl-C or Ctrl-Break
        to abort the command.  You can always run the exactly same
        command to resume where you stopped the last time.  While you
        are running this command in the background, a number of files
        may be created.  No problem.  When you are ready for the final
        round, just stop all activities and just run the command once
        more.  It will quickly save the newly created file.  Usually,
        the virtual memory swap file (WIN386.SWP) cannot be accessed
        when you run Win9x.  For all practical purposes, this file
        need not be duplicated in order to use the drive as the system
        (bootable) drive.  You need not format the hard disk as the
        system disk prior to running this XXCOPY command.  Nor you need
        to run the SYS.COM command (to transfer the system files).
        All hidden/system files necessary to boot the system will be
        there.
    
      Caution:
    
        The /CLONE, /Z, and /ZY switch performs deletion of extra
        directories and files in the destination.  If you inadvertently
        specify a wrong destination, the consequence will be very
        severe.  Some careless users have lost many files by this!!!
    
      Note:
    
        The only thing which may be missing from the newly cloned disk
        is the Master Boot Record (MBR) which is not really a file.
        The first logical sector (512 bytes) on the drive is called MBR
        which must be initialized by FDISK (or by some third party
        products).  Keep a bootable diskette with FDISK.EXE handy.
        After connecting the new drive as the first drive (FDISK
        call the first drive DISK 1), reboot the system using the
        bootable diskette, run FDISK and make the first Primary DOS
        partition Active.
    
      Note:
    
        We do not recommend using XXCOPY16 to clone the entire drive.
        (details are discussed the XXCOPY10.HTM article).
    
    
        A complete discussion is found in another article (XXTB #10)
    
    
    --------------------------------------------------------------------
    Coping files from another computer on a network.
    
      XXCOPY  \\myserver\c\yourdocs\*.doc   c:\mydocs\
    
        This command copies all .DOC files (Microsoft's Word document)
        from a computer named "myserver", drive named 'C'. directory
        named \yourdocs\.  The source name starting with two consecutive
        backslashes are so-called UNC (Universal Naming Convention) name.
        When a resource (such as a hard disk) is made sharable to other
        users outside the computer, the resource must be given a name.
        Usually Drive C is named just 'C' by convention (NetWare encouraged
        the naming like "DRIVEC").  Therefore, the "root" of the remote
        resource over the network will not be the computer name alone.
        At the minimum, you need to specify the resource name for the
        drive (such as \\myserver\c\" which will act as the root directory
        of the volume).  In this example, the source directory is locally
        (on the computer) known as C:\dest\.
    
    
    --------------------------------------------------------------------
    Coping files to another computer on a network.
    
      XXCOPY  c:\mydir\*.doc    \\myserver\c\dest\
    
        The UNC path specifier can be used for the destination directory.
    
        Caution:  If the target resource is available on a read-only
        basis, then, it cannot be made the destination of copy operation.
        Some system allows you to access only on a read-only basis.  In
        that case, you can read the files but cannot write to the
        directory, rename or, delete.  Any modification of the contents
        is considered a write-access.
    
        Check with your network administrator for details.
    
    
    --------------------------------------------------------------------
    List up device driver files of certain date.
    
      XXCOPY  c:\Windows\*.DLL      /S /L /DO:1999-04-23
    
        The date shown here happens to be one of the Microsoft release
        dates.  The DLL files originally installed from the setup
        CD-ROM will be listed by this command.
    
      XXCOPY  c:\Windows\system\*.DLL  /L /DO:1999-04-23
    
        This is a variation of the above, without /S so that the listing
        is made only from the specified directory.
    
    
    --------------------------------------------------------------------
    Create a list of all files in the volume.
    
      XXCOPY  c:\  c:\mylist\   /H /E /TR0 /CCY /KN
    
        This command creates a directory entry for each and every file
        in the volume in the destination directory.  The file contents
        are not copied (using /TR0 to limit the new file to be 0 byte).
        It effectively create a catalog of existing files.  /CCY prevents
        the cyclic copy meltdown. /H includes hidden files.  /KN is an
        optional switch to convert hidden/system files to visible file
        for your convenience (you may drop this switch).
    
      XXCOPY  c:\  c:\mylist\   /KS /H /E /R /Q /Y /BX /ZY /TR0 /CCY
    
        A variation to the one before.  This command synchronizes the
        file list created earlier by removing extra files (/ZY) and
        adding those files that has different file time (/BX).  Although
        we could have chosen /KN as before.  But, we chose to use a
        different way to save the file attributes using /KS.  It retains
        the same file attributes as they are in the source directory
        --- which in turn necessitates /R which is needed to overwrite
        read-only files.  Here, the /BX is a superior choice to /BB
        because /BX rewrites the file which had a different file time
        whereas /BB would skip the file which already exists --- leaving
        files with old file time without being updated).  /BX is better
        than /BI (which checks both file time and file size).  That's
        because with /BI, the presence of /TR0 forces the file size to
        be different (0 byte) for nearly all files, almost all files
        would be rewritten.
    
      Caution:
    
        The /CLONE, /Z, and /ZY switch performs deletion of extra
        directories and files in the destination.  If you inadvertently
        specify a wrong destination, the consequence will be very
        severe.  Some careless users have lost many files by this!!!
    
    
    --------------------------------------------------------------------
    Copy files and delete them from the source (i.e., move files).
    
      XXCOPY \src\  \dst\  /RCY /S
    
        The /RC switch stands for Remove-after-Copy.  The Y suffix
        suppresses the (Y/N/A) prompt on each file delete.  To suppress
        the (Y/N/A) prompt for file-overwrite cases, add /Y.  /S goes
        through subdirectories.  Of course, you may add other common
        switches such as /H (include hidden/system files), and
        /R (overwrites even read-only files),
    
    
    --------------------------------------------------------------------
    Delete files which are present in the reference directory
    
      XXCOPY c:\src\*.doc  d:\reference\   /RS /U
    
        The /RS switch removes files in the first (src) directory which
        matches the template (*.doc).  The /U switch specifies that the
        delete operation will be performed on files that are present
        in both the ssrc directory and the reference directory.  To
        understand the file selection mechanism, first consider this is
        an ordinary file-copy operation.  If so, the /U switch (which
        stands for "update") selects files which exists on the
        destination directory.  The /RS switch changes the mode of
        operation from file-copying to file-deletion.  But, the file
        selection mechanism is identical.
    
    
    --------------------------------------------------------------------
    Clean up the Windows temporary directory
    
      XXCOPY %TEMP%\  /RS /DB#1 /R /H /PD0 /Y /ED
    
          /RS    Removes files in the source (the only) directory
          /DB#1  Selects files made on or before yesterday
          /R     Deletes even a read-only file
          /H     Deletes even a hidden/system file
          /PD0   Suppresses the prompt which would appear on a directory
          /Y     Suppresses the prompt prior to each file-delete
          /ED    Preserves the directory even if it becomes empty
    
          In the standard Win9x system setup, the %TEMP%  Environment
          variable is set to the Windows designated temporary directory
          (usually C:\Windows\temp).
    
          By specifying the files that were made on yesterday or earlier,
          this command will not accidentally delete files that may be
          still in use in the current session (i.e., files created today).
    
    
    --------------------------------------------------------------------
    Treatments of redundant files
    
      XXCOPY c:\src\*.doc  d:\dst\   /BI /S
    
        This command is a common case where incremental backup is
        performed on a selected (*.doc) files in the source (and its
        subdirectory).  The /BI switch skips files that are already
        present in the destination with the same file time and size.
        That is, files which are different or the files that are
        new to the destination will be copied.
    
      XXCOPY c:\src\*.doc  d:\dst\   /BS /S
    
        This is a hypothetical command and such an operation is seldom
        carried out.  But, it helps understand what /BS does.  /BS is a
        strange switch for an ordinary copy operations.  That is because
        /BS (Backup Same) is exact opposite of /BI (Backup Incremental).
        It selects and copies files that are identical in file date and
        the size --- which results in no net change!!!  The /BS is not
        useful under normal circumstances (unless you want to exercise
        the hard drive for testing purposes).
    
      XXCOPY c:\src\*.doc  d:\reference\   /RS /BS /S
    
        The funny /BS switch now makes a lot of sense when combined
        with /RS (remove files in source).  Files which are present
        in both the source and reference directories will be examined
        with respect to the file time and file size.
    
        Here, the files with the same file time and size which matches
        the pattern (*.doc) in the source directory (/S specifies its
        subdirectories) will be removed.
    
      XXCOPY c:\src\*.doc  d:\reference\   /RS /BS /S /L
    
        The /L switch gives you a list of files which would be
        selected by the duplicate-elimination operation.
    
      XXCOPY c:\src\*.doc  d:\reference\   /BS /S /L
    
        For that matter, the presence of /RS makes no difference
        because, /L has precedence over /RS.  Therefore, the operation
        becomes file-listing only.
    
    
    --------------------------------------------------------------------
    Eliminate redundant files (delete identical files)
    
      XXCOPY c:\src\*.doc  d:\reference\   /RS /BS /S
    
        This is another RS variation.  Again, two directories are
        given (the second directory provides the reference files for
        comparison).  /BS is a strange switch for an ordinary copy
        operations.  That is because /BS (Backup Same) is exact opposite
        of /BI (Backup Incremental).  The BI switch compares a pair
        of files between the source and destination and checks whether
        the pair of files have the same file-time and size.  If both
        matches, the two files are considered to be the same and file
        copy will be skipped.  Being the exact opposite of /BI, the BS
        switch would normally copy only identical files --- which
        results in no net change!!!  But, the file selection mechanism
        makes a lot of sense when it is applied for file deletion.
    
        Here, the files with the same file time and size which matches
        the pattern (*.doc) in the source directory (/S specifies its
        subdirectories) will be removed.
    
    
      XXCOPY c:\src\*.doc  d:\reference\   /RS /BS /S /L
    
        The /L switch gives you a list of files which would be
        selected by the duplicate-elimination operation.
    
      XXCOPY c:\src\*.doc  d:\reference\   /BS /S /L
    
        For that matter, the presence of /RS makes no difference
        because, /L has precedence over /RS.  Therefore, the operation
        becomes file-listing only.
    
    
    --------------------------------------------------------------------
    Remove files in all subdirectories but leave certain files.
    
      XXCOPY c:\mydir\  /RMDIR /Y /Xtemplate.* /X*.doc
    
        /RMDIR is like DELTREE.  Here, /Y suppresses confirmation.
        The two /X switches specify filename patterns to avoid
        deletion.
    
    
    --------------------------------------------------------------------
    Three-way Differential Backup
    
      The scheme works like this:
    
      1.  Initially you make a full backup from \src\ to \ref\.
      2.  Later, you want to perform a daily differential backup
          from \src\ to \dst\ using the difference between \src\ and \ref.
    
      The initial step is usually a full backup
    
        XXCOPY  \src\  \ref\  /CLONE
    
      The daily differential backup requires three steps as follows
      (for illustration purpose, common switches are deliberately left
      out here).
    
        XXCOPY  \src\          /AZ
        XXCOPY  \src\  \ref\   /AA /BI
        XXCOPY  \src\  \dst\   /A
    
        The first step clears the archive bit of every file in the source.
        The second step sets the archive bit of the files you select.
        The third step performs the actual file copy.
    
      Very common cases (subdirectory included, hidden files also copied)
    
        XXCOPY  \src\          /AZ     /S
        XXCOPY  \src\  \ref\   /AA /BI /S /H
        XXCOPY  \src\  \dst\   /A      /S /H /KS
    
      With a twist of incrementally do the three-way differential backup
      to the same destination every day (remove extra files)
    
        XXCOPY  \src\          /AZ     /S
        XXCOPY  \src\  \ref\   /AA /BI /S /H
        XXCOPY  \src\  \dst\   /A      /S /H /KS /ZY
    
      Caution:
    
        The /CLONE, /Z, and /ZY switch performs deletion of extra
        directories and files in the destination.  If you inadvertently
        specify a wrong destination, the consequence will be very
        severe.  Some careless users have lost many files by this!!!
    
    
    --------------------------------------------------------------------
    Differential Backup using a skeleton directory.
    
      This scheme is similar to the Three-way differential backup
      described above.  In that case, the reference directory \ref\,
      consumes a relatively large storage space just to provide the
      reference (where the file contents are never referenced).
      This variation drastically cuts down the storage usage by the
      reference directory by storing only zero-length files.  It
      still allows you to compare filename and the file date as the
      criteria for differential backup.  In other words, the skeleton
      directory serves as a file set specifier for regularly performed
      backup.
    
      The initial step here uses /TR0 to make zero-length files.
    
        XXCOPY  \src\  \ref\  /CLONE /TR0
    
      You may remove whatever files you are not interested in
      backing up (such as WIN386.SWP), thereafter in order to
      make the most desired file set in the reference directory
    
      The daily differential backup in this case uses /U to
      (for illustration purpose, common switches are deliberately left
      out here).
    
        XXCOPY  \src\          /AZ /S
        XXCOPY  \src\  \ref\   /AA /S /H /U /BX
        XXCOPY  \src\  \dst\   /A  /S /H /KS
    
        Note: the second step here uses /U (selects files that are
        present in the reference directory) and  /BX (exclude files
        with the same file date).
    
      Caution:
    
        The /CLONE, /Z, and /ZY switch performs deletion of extra
        directories and files in the destination.  If you inadvertently
        specify a wrong destination, the consequence will be very
        severe.  Some careless users have lost many files by this!!!
    
    
    This page will remain forever under construction...
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #12


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: The file removal features in XXCOPY
    Date:    2000-11-17  (revised)
    ====================================================================
    
    Why are we always short in the storage space?
    
      No matter how big your hard disk is, it gets full sooner or later.
      Microsoft is often blamed for their "bloatware".  But, here is
      another theory.  There are just more programs which create files
      than those which delete files.  If you look at common applications,
      usually they offer more ways to create files than to destroy them.
      Therefore, to maintain a healthy equilibrium between the file
      creation and the file deletion, we need to put more conscious
      effort in file removal.  In the case of XXCOPY, it has been used
      primarily for file copying, and not much for file removal.
    
      Now, starting with Version 2.25, XXCOPY has a whole new set of
      file removal features.
    
    
    File removal using a file copy utility?
    
      Why are we adding to XXCOPY more features which are not directly
      related to the file-copy function?  A good question.  Why not
      produce a separate file-delete utility?  That makes sense if you
      expect a simple one.  But, for that matter, you already have
      DELTREE from Microsoft.  Again, XXCOPY fills the void.
    
      Once you learn XXCOPY's rich set of file selection scheme in
      various file copy operations, you would want the same kind of
      power in file removal operations as well.  Therefore, instead of
      making a very similar program for file deletion, it is more
      natural to use the exact same file selection mechanisms of
      XXCOPY for file removal operations.  The notion of a file copy
      utility with a patch to handle file deletion should be thrown
      away.   It is only in its name, XXCOPY, which may mislead you on
      what it is capable of.  It is now a general purpose file management
      tool and the file removal feature is certainly an important one.
      In totality, we believe that you will spend less time learning the
      new features in the enhanced XXCOPY utility than you would spend
      in studying a brand new file delete tool.
    
    
    The design principle of XXCOPY's file removal.
    
      We added just a few file removal functions which combine well with
      existing framework of XXCOPY's file selection schemes.  The new
      file removal functions all start with the letter R (for removal).
    
       Switch   Mnemonic          Files to be removed
       ------------------------------------------------------------------
        /RC   Remove-after-Copy   files in source after a successful copy
        /RS   Remove-Source       files in source which qualify
        /RD   Remove-Destination  files which qualify to be overwritten
        /RX   Remove-Extra        files which do not exist in the source
    
        (More minor variations are specified by optional third letter).
    
      Any of the above switches modifies the basic operation from file-
      copy to file-removal.  But, most other switches which engage in
      the file selection process apply equally to the file removal case.
    
    
    The actions by the four variations in the file removal.
    
      With the first two variations (/RC and /RS), the file removal takes
      place in the source directory whereas in the last two cases (/RD
      and /RX), the operation takes place in the destination directory.
    
      The file copy operation is performed only with the first variation
      (/RC) and no copy is performed by the other three (/RS, /RD, /RX).
      Therefore, the designation of the source and destination for the
      command arguments (the non-switch parameters, ones without a slash)
      is admittedly weak.  But, in light of their origin being the file
      copy operation, they still carry some nuances.  The reference
      (destination) directory plays a vital role in file selection.
    
    
      /RC  (Remove-after-Copy)
    
            This switch first performs a regular file copy operation,
            and then removes the source file when the copy is successful.
            In essence, it is a file move operation.  Nearly all common
            XXCOPY switches designed for file copy apply in this case.
    
      /RS  (Remove-Source)
    
            This switch removes the source file without a copy action.
            In some cases, you specify only the first argument
            (the source specifier) without the destination.  However,
            there are many instances where you select files based on
            the relationships to the files in the reference (destination)
            directory.  For example, you may delete the files in the
            source that are older than the one in the destination.  You
            will probably use this switch more often than the other
            switches in this group.
    
      /RD  (Remove-Destination)
    
            This switch removes the files which would normally be
            overwritten.  The file selection process is exactly the
            same as in the cases of file copy.
    
      /RX  (Remove-Extra)
    
            This switch removes the files in the destination whose
            corresponding file is not present in the source directory.
            This command is somewhat similar to the /Z switch which
            accompanies regular file copy operations.  The difference
            with the /Z and /ZY commands is, of course, these commands
            carry out file copy actions whereas /RX does not copy at all.
    
    
    The cases with /RD and RX --- Cautions.
    
            When you use the /RD or /RX switch, there are a few things
            you should remember.  Although the focus of the action is
            on the files which are to be removed, when these files are
            in the destination, many of the XXCOPY switch parameters
            does not work with the files in the destination directory.
    
            For example, when you specify /RD (remove destination) with
            /DB#4 (files more than 5 days old), the file date in the source
            is checked, not the one that would actually get removed.  This
            is because the /RD switch borrows XXCOPY's basic file-selection
            mechanism to determine which source-destination file pair
            to operate on.  This particular operation happens to be to
            remove the file in the destination rather than the one in
            the source.  It may be a little confusing but we can't help.
    
            It may be even more true with the /RX switches where the
            files are removed simply by the virtue of being in the
            destination as extra.  In this case, your additional switches
            such as /A (files with Archive bit set), /DB#4 (older than
            four days), or even /DA (when the file in destination is
            older than in the one in the source).  Remember, with the
            /RX switch, the files to be removed has no counterpart in
            the source!!!  So, all these switches will be just ignored.
    
            Our recommendation is that you should use the /RD and /RX
            switches for relatively simple file selection cases only.
            When you start adding many file selection switches, we advise
            you rewrite the XXCOPY /RD command using /RS/U with the source
            and destination reversed.  Similarly, an XXCOPY /RX command
            can be written using /RS/BB with source and destination
            reversed.  By having the files for removal in the source
            side in the command, you will have all the switches which
            applies to the files which would actually be removed.
    
    
    Convenient shortcut:
    
      /RMDIR  Removes the specified directory including the files and
              subdirectories inside.
    
      This /RMDIR switch makes XXCOPY to behave like Microsoft's
      DELTREE utility.  The following two commands are very similar.
    
        DELTREE c:\mydir
    
        XXCOPY  c:\mydir  /RMDIR
    
      However, the power of XXCOPY become evident when it is combined
      with other switches.
    
        XXCOPY  c:\mydir  /RMDIR /DA:2000-04-01 /Y /X*.doc
    
          This command removes files inside the directory which are made
          on or after the specified date but avoids deleting .DOC files.
    
    
    Examples of the file removal switches.
    
      xxcopy c:\mydir\myfiles.*  c:\destination\  /RC
    
        The files which match the pattern, "myfile.*" in c:\mydir\ and
        all of its subdirectories will be deleted after copying.  If
        copy fails for any reason, the files in the source will *NOT*
        be removed.  It behaves essentially like the MOVE command.
    
    
      xxcopy c:\mydir\myfiles.*  /RS /S /H
    
        It is similar to DELTREE, subdirectories are specified.  The
        files which match the pattern, "myfiles.*" in c:\mydir\ and all of
        its subdirectories will be deleted.  No copying will take place.
        The /H switch is needed if you want to include hidden and/or
        system files.
    
    
      xxcopy c:\mydir\myfiles.*  c:\reference\   /RS /S /H /DB
    
        The /DB switch uses the second directory (c:\reference) which
        supplies the filenames to compare the file time against the
        files in the source.  The files in the source which are made
        before (/DB stands for DATE:BEFORE) their counterpart in
        destination will be removed.  In this case, the files that
        do not exist in the reference directory will also be removed.
    
    
      xxcopy c:\mydir\myfiles.*  c:\reference\   /RS /S /H /DB /U
    
        This is exactly same as the one above except this has the
        /U switch (update --- applies only to files that exist in the
        destination) will not remove files that do not exist in
        the destination.  This is a quite useful combination to remove
        those files whose new version exists in the reference directory.
    
    
      xxcopy c:\mydir\myfiles.*      c:\reference\   /RS /S /H /U
      xxcopy c:\reference\myfiles.*  c:\mydir\       /RD /S /H /U
      xxcopy c:\reference\myfiles.*  c:\mydir\       /RD /S /H
    
        Here, three variations of file removal actions are specified.
        But, they achieve exactly the same result.  The first one
        removes the qualified files in the source (and its
        subdirectories) if they exist in the reference directory.
        Please note the change in the position of the c:\mydir
        argument in the second and third examples above.  In the
        second example, the /U is superfluous because the /RD switch
        (file in the destination that would be overwritten) implies
        that in order to be overwritten, its counterpart must exists
        in the source.  The third example proves that /U in the second
        example was not necessary.  On the other hand, /U must be
        in the first example; without it, the files in the reference
        directory will be totally ignored.
    
    
      xxcopy c:\reference\myfiles.*  c:\mydir\       /RX /H /S
      xxcopy c:\reference\           c:\mydir\       /RX /H /S
    
        These examples eliminate all files in the destination whose
        counterpart does not exist in the source directory will be
        removed.  They resembles the /Z switch where qualified files
        will be overwritten by the source files.
    
    
      xxcopy c:\mydir\myfiles.*  c:\destination\     /RS /H /S
      xxcopy c:\mydir\myfiles.*                      /RS /H /S
    
    
        These two will result in the same action, namely, removing
        the matched files in the source and its subdirectories.
        In the first example, since there is no switches which
        references the second directory specifier (c:\destination),
        the second argument was totally unnecessary and ignored
        (without warning).
    
    
      xxcopy c:\mydir\myfiles.*   /RS /S /H /DB#7
    
        Remove files which match the template in the source and
        its subdirectories which are more than seven days old.
    
    
      xxcopy c:\       /RS /S /H /DA:2000-02-01 /DB:2000-02-29
    
    
        Remove all files which were made during the month of
        February 2000.
    
    
      xxcopy c:\mydir\  c:\backup\   /RS /S /H /BI
    
        Remove files in c:\mydir\ and its subdirectories that are
        identical in date and size.
    
    
      xxcopy c:\mydir\               /RS /S /Ho
    
        Remove all hidden files in c:\mydir\ and its subdirectories.
    
    
      xxcopy c:\                    /RS /A
    
        Remove all files in the root directory with the archive bit set.
    
    
      xxcopy c:\mydir\*.jpg         /RS /Xmydear.jpg
    
    
        Remove all .JPG files but keep mydear.jpg.
    
    
    Confirmation prompts.
    
      Since file removal is a serious business, XXCOPY always asks you
      for confirmation before removing a directory.  As a matter of fact,
      XXCOPY provides two levels of confirmation prompts.
    
      1.  On each directory to process.
      2.  On each file to delete.
    
      Of course, for batch file execution, you normally do not want such
      confirmation.  Also, to allow flexible control, the prompt includes
      a choice to eliminate further confirmation in the current and
      subsequent items.
    
      Unfortunately, the rules for the confirmation prompts are quite
      complicated because of the many cases involved.  You may skip the
      following three sections for now and come back to read the gory
      details later.  Just remember that you can suppress the Yes/No
      prompts in the two levels by /PD0 and /Y, respectively.
    
    
    Directory-removal confirmation prompt.
    
      Before each directory to process, you will be given a chance to
      skip the directory by a prompt with
    
       (Y/N/A/R/S)?
    
       Y  for Yes (Yes, process the current directory for removal)
       N  for No  (No, skip the current directory and go to the next one)
       A  for Yes for All remaining directories (suppresses subsequent prompts)
       R  for Yes for the current and Remaining siblings and its subdirectories.
       S  for Yes for the current and its subdirectories.
    
      The Y(es) and N(o) inputs are the most obvious cases.  They apply
      to the current directory only.  The A(ll) input is also pretty easy
      to understand.  It applies the current and all subsequent cases by
      and suppresses the prompts once for all.  The R and S inputs are
      partial suppression and a bit confusing: When you type R, the current
      directory and remaining (sibling) directories will be removed without
      further prompting.  But, the effect of R response will not affect the
      parent directory level.  When you type S, it is the most restrictive
      response of all.  It affects the current and its subdirectories only.
      The next directory in the same level will not be affected by the R
      input.
    
      Here are how to suppress and unsuppress the directory-removal prompts.
    
        /PD   Enables the directory-level prompt.
        /PD0  Disables the directory-level prompt.
    
    
    File-delete confirmation prompt.
    
      Another level of confirmation is on a file-by-file basis.  Before
      each file is to be deleted, you will be asked by a prompt with
    
       (Y/N/A)?
    
       Y  for Yes (Yes, delete this file)
       N  for No  (No, skip this file)
       A  for Yes for All remaining files (suppresses subsequent prompts)
    
    
      Here are how to suppress and unsuppress the file-delete prompts
      (applicable for /RS, /RD, and /RX cases).
    
        /Y   Disables the file-delete prompt.
        /-Y  Enables the file-delete prompt.
        /Y0  Enables the file-delete prompt (same as /-Y).
    
    
    More confirmations on /RC (Remove-after-Copy).
    
      The /RC switch is a special case in the removal switch group.  It
      performs a file copy action before the source file is deleted.
      As with other file-copy functions, /P insert a confirmation prompt
      (Y/N/A)? to perform the copy operation first.  The regular rules
      for the /P switch applies exactly in the case /RC switch.  There is
      one more case of (Y/N/A)? prompt which may appear with the /RC
      operation --- file-overwrite confirmation.  Just like the regular
      file copy operation, when there is a file in the destination, you
      will be asked for confirmation.  The /Y, /-Y, and /Y0 for /RC switch
      control the suppression of the file-overwrite prompt rather than
      the delete-after-copy prompt.  Therefore, we need one more switch
      convention to enable/disable the file-delete confirmation prompt:
    
        /RC  (Remove-after-Copy) enables Y/N prompt on remove (same as /RCP)
        /RCP (Remove-after-Copy) enables Y/N prompt on remove
        /RCY (Remove-after-Copy) suppresses Y/N prompt on remove
    
        The optional third letter (P or Y) specifies the removal prompt.
    
      Similarly, the other variations in the file remove operation also
      accepts the third letter (to be symmetrical to the /RC switch).
    
        /RS  (Remove-Source)   enables Y/N prompt on remove (same as /RSP)
        /RSP (Remove-Source)   enables Y/N prompt on remove
        /RSY (Remove-Source)   suppresses Y/N prompt on remove
    
        /RD   (Remove-Dest)    enables Y/N prompt on remove (same as /RDP)
        /RDP  (Remove-Dest)    enables Y/N prompt on remove
        /RDY  (Remove-Dest)    suppresses Y/N prompt on remove
    
        /RX   (Remove-Extra)   enables Y/N prompt on remove (same as /RXP)
        /RXP  (Remove-Extra)   enables Y/N prompt on remove
        /RXY  (Remove-Extra)   suppresses Y/N prompt on remove
    
      The /Y and /-Y switches also control the prompt for file remove
      action for /RS, /RD and /RXn (not with /RC) switches.
    
      To undo any of the /RC, /RS, /RD, or /RX switches, append letter zero
      (e.g., /RC0, /RS0, /RD0, and /RX0 respectively).
    
    
    Conclusion:
    
      The examples given here hopefully show that the file removal
      feature in XXCOPY is merely an extension to other XXCOPY switches
      and basically the same rules apply here.  In the case of file
      removal, probably less than a half of operations use the files
      in the second directory (destination) as a reference where the
      /RS switch is usually selected.  The next common cases involves
      in /RD which is used for elimination of multiple copies of the
      same files.  Although there are some switch combination which
      makes no sense with the file removal cases, many are expected
      to be quite useful.  Since not all of the switch combinations
      are thoroughly tested, there may be some contradictory definition
      of rules (or even actions) may arise during the beta testing.
    
      If you find an interesting switch combination which is quite
      unique and valuable in common cases, please let us know.  it
      seems that this scheme generates a very large number of
      combinations many of which are not intuitive.  It is entirely
      possible that someone may come across an interesting behavior
      which none else has ever thought of.  Only time can tell.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #13


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY Frequent Asked Questions (FAQ)
    Date:    2001-09-01
    ====================================================================
     
    Q0:  Can I do xxxxxxxxxxx with XXCOPY?
         (Fill in xxxxxxxxxxx with your own words)
    
    A0:  The most likely answer to the question is YES.  XXCOPY can do
         most common file management jobs quite nicely.  But, as the
         number of the XXCOPY switches grows, it is getting harder and
         harder to find the right command line argument for a given job.
         The recent addition of a few technical bulletins should help.
    
           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
    
         Especially, the Functional Classification article, XXTB #27
         seems to be the easiest way to see the overall picture.
    
         If your company has an urgent need for a file management job whose
         requirements are mostly met by XXCOPY but not exactly, and you wish
         to have an XXCOPY with a minor customization, please consult us.
         We may provide solutions to your need at reasonable time/price.
    
     
    Q1:  What is the difference between XXCOPY, XCOPY, and other similar
         programs.
    
    A1:  Let us list the utility programs which are related one another.
    
           XXCOPY.EXE   The logical extension to XCOPY - most powerful.
           XCOPY.EXE    Microsoft's command-line based copy utility
           COPY         Internal command to COMMAND.COM (Microsoft)
           XCOPY32.EXE  XCOPY's Win-32 program which XCOPY runs when
                        invoked inside Win9x/ME/NT/2K.
           XXCOPY16.EXE XXCOPY's predecessor. written for 16-bit (real mode)
                        environments such as DOS.  Supports most but not
                        all of XXCOPY's switches.
           ROBOCOPY.EXE Microsoft's version of an extended XCOPY utility.
                        It is bundled in Windows NT/2000/XP Resource Kit.
                        ROBOCOPY runs on WinNT or Win2000, not DOS nor Win9X. 
           DCOPY32.EXE  Essentially the same as XXCOPY.EXE.  It is bundled
                        with Pixelab's DATMAN-99 tape control software.
           DCOPY.EXE    Essentially the same as XXCOPY16.EXE.  It is bundled
                        with Pixelab's DATMAN-DOS tape control software.
    
         In short, XXCOPY and XXCOPY16 are Pixelab's products which
         extend the features of XCOPY32 and XCOPY respectively.
    
     
    Q2:  I need to copy the top level of a directory structure only.
         I want to copy the user home directory structure from one server
         to another without copying any sub dirs or files.  I have tried
         the /T switch but it seems to copy the sub dirs.
    
    A2:  Among all switches, the feature to go deep into subdirectories
         is controlled by /S (for subdirectory) and /E (for subdirectory-
         even-if-it's-empty).  Therefore, if you don't use /S or /E in
         the switches, it's OK.  However, these switches are also
         incorporated in a few other combined switches such as /BU
         (equivalent to /R/I/BI/Q/C/H/E/V/Y) and /CLONE (equivalent to
         /KS/H/E/R/Q/Y/BI/ZY) which makes it tricky.
    
         The easiest way to avoid the inclusion of /S or /E in such hidden
         cases is to explicitly cancel such hidden inclusion by adding
         /S0 the end of your switches.  That is, you can combine with any
         switches and put the /S0 switch to the right which will be
         evaluated last and therefore override any earlier inclusion.
    
            XXCOPY c:\mysource  c:\mydest  /CLONE  /S0
    
     
    Q3:  I want to clone source to destination but only files with certain
         extension(s). When I use    XXCOPY c:\src\*.ext d:\dest /CLONE
         it also deletes files with different extension at destination.
         I cannot figure out which switches to use.
    
    A3:  As explained in A2 above, the /CLONE switch is a shortcut for a
         combination of switches.  In this particular case, the /ZY switch
         is responsible for the file deletion.  As the name implies,
         the CLONE operation is to create a destination directory which
         resembles to the source directory as closely as possible.  That
         includes the removal of extra directory and files that should not
         be there.  So, to retain all the component switches of /CLONE
         except the /ZY part, just add the cancelling switch (/Z0) to the
         right hand side.  That is  /CLONE /Z0  will do the job.
         
         When you glance over the set of switches that are supported by
         XXCOPY, you will find a cancelling switch for nearly every switch
         (which usually ends with a zero (0) at the end).  The cancelling
         switches are convenient to reverse the effect of a long combination
         of switches which has been set earlier (to the left hand side).
         
     
    Q4:  When I use the Win9x boot diskette, I cannot use XXCOPY since
         it is the 16-bit (essentially a DOS) environment.  Although I
         can use XXCOPY16, it does not use any long filename.  How can
         I copy directories in DOS (real mode) and restore long names.
    
    A4:  It is true that there is no one-step solution to deal with the
         long filename.  But, this is what we recommend.
    
         1. Copy files using any of the 16-bit utilities you have.
            This will give you many files and directories with funny
            names (e.g., \PROGRA~1).  That is fine as the fist step.
    
            We suggest the use of XXCOPY16, simply because it is the
            most versatile utility with lots of options.  If you want to
            include hidden files and also to preserve file attributes,
            we suggest XXCOPY16.
    
              XXCOPY16  c:\mydir  d:\mydir /KS /H /E /R
    
         2. Once you are in Win32 (Win9x/ME/NT/2K), run XXCOPY with the
            special file renaming switch as follows
    
              XXCOPY  c:\mydir  d:\mydir  /NL /E
    
            In most cases, you probably want to add the /E switch to
            handle all files and subdirectories inside.
    
     
    Q5:  When I use the /RS switch to delete a directory, it always shows
         a prompt "Dir (Y/N/A/R/S)?  How can I get rid of the prompt inside
         a batch file.  Also, what are the meaning of the prompt?
    
    A5:  The Remove switch group has additional level of confirmation
         prompt due to the deadly consequences.  The prompt is controlled
         by the /PD (Prompt-on-Directory) and /PD0 (No Prompt-on-Directory)
         switches.  It appears before a directory is to be processed.
    
         Rather than having All-or-Nothing control, it provide the R and S
         responses which gives you Partial-Yes options.
    
         (Y/N/A/R/S)?
    
         Y  for Yes (Yes, process the current directory for removal)
         N  for No  (No, skip the current directory and go to the next one)
         A  for Yes for All remaining directories (suppresses subsequent prompts)
         R  for Yes for the current and Remaining siblings and its subdirectories.
         S  for Yes for the current and its subdirectories.
    
     
    Q6:  I try to run a server backup using XXCOPY's incremental backup
         switch (/BI).  It works well with local drives.  But when I
         try /BI from one volume to another, sometimes nearly half of the
         files always get copied even though I know most of them have never
         been changed since the last backup.  Why /BI does not work on
         some volume?
    
    A6:  Add the /FF (Fuzzy Filetime) switch in such cases.  With the
         switch, XXCOPY considers two timestamps the same if they are
         within a pre-determined number of seconds (/FF is the same
         as /FF2 --- for plus/minus 2 seconds).  In most cases, the
         default setting of plus/minus 2 seconds works well.
    
         Here is why...
    
         The /BI operation compares the file size and time stamp between
         the file in the source directory and in the destination.  Due to
         different file time format used in various file systems, the time
         stamp on a file gets truncated, resulting in a different file time
         after a copy.  When such files are compared against their
         counterparts in the source directory, the file times do not match.
         This is most commonly experienced when you copy files from an
         NTFS volume to FAT (both FAT16 and FAT32) volume.  Similarly,
         FAT and Unix/Linux file system has file date incompatibilities.
    
            File system    Time Resolution (Granularity)
           ----------------------------------------------
               FAT12             2 sec
               FAT16             2 sec
               FAT32             2 sec
               NTFS              100 nsec
               Unix/Linux        1 sec
    
         Whenever you run XXCOPY operation which involves a file date
         comparison (e.g., /BI, /BX) across different file systems,
         use the /FF switch.  
    
         The new /FF switch supercedes /FT and /FR which were /FF's
         prececessors.
    
     
    Q7:  Is there a way to perform an incremental backup but ignore the
         file time.  That is, I want to select files of different size.
    
    A7:  Yes, the /BZ switch is for you.  You can choose a backup scheme
         from the following variations.
    
          /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  Backs up different-size 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)
    
          /U   Updates the files that already exist in destination.
    
          Note:  The /Bx switches are mutually exclusive one another,
                 but /U may coexist with a /Bx switch.
    
     
    Q8:  I have seen variations for the home page URL of XXCOPY.
         Which is the real home page?
    
    A8:  The current official home page URL for XXCOPY is
    
            http://www.xxcopy.com/
    
         Our corporate home page is
         
            http://www.pixelab.com/
    
         Now, all of the freeware download files are stored at the
         following directory:
         
            http://www.pixelab.com/download/
         
         In the past, we have also used the following addresses  
    
            http://www.xxcopy.com/xxcopy/
            http://www.datman.com/xxcopy/
    
         Now, we encourage you to use the shorter form.
    
    
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    
         We also run a beta test for which we estabished a full web site:
         
            http://www.xxcopy.com/betatest/
    
         If you are looking for a feature which is not supported by the
         current release version, you may try the beta test site.  The
         documentation files in the batatest site reflect the extended
         functionality of the beta version.
    
         Usually, a beta test version is well debugged.  But, of course, 
         it is less mature than the current release version.  Since we
         pay close attention to bugs and we try to correct serious
         problems as soon as they are discovered, you may estimate the
         stability of a particular beta test version by the date it was
         created.  If you feel uneasy to run an "untested" version, wait
         a few weeks.  If the same beta test version is still there,
         it will have gone through the scrutiny that much longer.
    
     
    Q9:  I can't back up the Program File directory using XXCOPY.  Why?
    
    A9:  It is very likely that you are not using quotation marks around
         the source directory name.  XXCOPY processes the command line by
         splitting the string of command line text into pieces using the
         space (or tab) character as the delimiter which separates the
         line into components.  When you have a multi-word name such as
         "Program Files",  XXCOPY will see it as two components.  You
         must tell XXCOPY that the two words are actually just one piece
         by surrounding the directory name using the double quotes (").
    
           XXCOPY c:\Progam Files     d:\dest\      // WRONG!!!
    
           XXCOPY "C:\Program Files"  d:\dest\      // CORRECT
    
         This is not XXCOPY's idiosyncrasies.  You can apply this technique
         to any operation in a DOS Box.  E.g., try it with DIR, CD, etc.
    
           DIR  "C:\Program Files"
           CD   "C:\My Documents\My Pictures"
    
     
    Q10: I can't make the /Fo, /ON and even /OA to work.  Here's my command
         line looks like.  What is wrong?
    
            XXCOPY  c:\mysrc\  c:\mydest\  /s  /Fo c:\temp\mybackup.log
    
    A10: This is a quite common problem with first time users.  As stated
         in the previous answer (A8), the space (and tab) character plays
         a very important role in the command line.  Although it may seem
         hard to read, any parameter for an XXCOPY command switch (such
         as /Fo which needs the filename) must follow the command switch
         immediately without a space character.  So, in your case, type
    
            /Foc:\temp\mybackup.log    (without space after /Fo)
    
         Although there are many command-line programs which permit or
         even require a space between the command switch and its parameter,
         XXCOPY is one of those programs that does not allow a space there.
         Actually, allowing an optional space between the command letter(s)
         (such as /Fo) and its parameter would create undesirable ambiguity
         in the command line syntax, it is best to keep it strict, albeit
         a bit ugly to read without a space there.
    
     
    Q11: My log list which is created by either /ON or /OA does not
         include the list of files just copied.  How can I list the
         files which are successfully copied in the log file?
    
    
    A11: The /ON/OA output was meant to be for error logging.  When
         you make a big backup job and save a log file, the few lines
         of error will be buried in the huge list of filenames.  Therefore,
         it is a deliberate XXCOPY design not to dilute the log file
         with voluminous success cases.  If you want a list of backup log
         that contains the names of the files which are copied, use the
         /Fo switch which is equivalent to the console output you get
         using the /F switch.
    
     
    Q12:  But, /Fo always overwrites the existing list file.  Is there
         a switch which allows me to append the list to an existing
         list file?
    
    A12:  No, there is no Append equivalent in the /Fo switch.  But, you
         can write the following sequence in your batch file to achieve
         the same goal.
    
             ...
             xxcopy  \src\ \dst\ /fonew.lst
             type    new.lst >> grand.lst
             ...
    
     
    Q13: When I run a backup using XXCOPY (XXCOPY src dst  /CLONE), on
         some file, I get a "data mismatch" error message.  What does it
         mean?
    
    A13: Immediately a file is copied, XXCOPY checks the size of the newly
         created file in the destination directory.  If the file size does
         not match the source, the error message will be shown.  Under
         normal circumstance, this should not happen.  But, in a multi-
         tasking environment such as Windows, a file which was just
         closed may be subjected to a modification by another process which
         is not necessarily a fatal condition.  XXCOPY does not interpret
         the severity of such an incident.  Therefore, it is up to you to
         make the assessment as to the purpose of the file.  In many cases,
         the error condition is not  very serious.  Otherwise, you may turn
         off *ALL* processes except XXCOPY when you clone the current volume
         to another volume.
    
     
    Q14: I want to obtain a list of files using XXCOPY's rich set of file
         selection mechanism but without acutally causing any actions like
         copying or removing files --- just a listing only.  Also, I want
         just a bare listing without even the file size info.
    
    A14: XXCOPY is no longer just a file copy utility, but a general purpose
         file management tool and searching and making a list of files is one
         of the jobs XXCOPY is well equipped.  I will show you a few examples
         as the answer
    
         XXCOPY  c:\mydir\*.jpg  /S /L
    
             The searchspec has the base directory part and a template part.
             /S is to include subdirectories (which usually the case)
             The /L switch is the starting point.  It shows file size.
    
         XXCOPY  c:\mydir\*.jpg   /S /L /ZS
    
             /ZS  without the sign-on and statistics info.  The bare list.
    
         XXCOPY  c:\mydir\*.jpg   /S /LL /ZS
    
             /LL  gives you longname only
    
         Actually, /Lxxxx is a general purpose list-formatter.  You can add
             L(ongname), S(hortname), Z(size), D(ate), T(ime), A(ttributes).
             Since Longname varies in length, for best list, place L last.
    
         Some more variations:
    
         XXCOPY  c:\mydir\*.jpg  /S /ZS /LD      // D(ate) L(ongname)
         XXCOPY  c:\mydir\*.jpg  /S /ZS /LDZL    // D(ate) S(ize) L(ongname)
         XXCOPY  c:\      /DA#0  /S /ZS /LDZL    // Only the files made today
    
     
    Q15: When I use XXCOPY16 in DOS and duplicate the entire C: drive to D:
         using the following command, I get funny filenames in the destination
         like XXXXXX~1.XXX.
    
           XXCOPY16  C:\  D:\  /CLONE
    
         How come the files are not copied correctly?
    
    A15: Although XXCOPY16.EXE supports almost all XXCOPY.EXE command switches,
         the longname related features (such as the handling of files using
         the long filename) cannot be supported.  The limitation is not of
         the XXCOPY16 program.  It is the real mode (DOS) environment which
         does not support the long filenames.  This is exactly why Microsoft
         invented the "alias" 8.3 filename in order for legacy (DOS) programs
         to be able to access files created under Win9x and NT/2000/XP with a
         long filename.  For more information about duplicating a disk drive
         under Win9x, there is another article on the subject with great detail
         XXTB #10.
    
     
    Q16: I understand XXCOPY can duplicate the system disk for Win9x/ME.
         What about the WinNT or Win2000?
    
    A16: No.  Not at this moment.  We have not come up with a sure way to
         make a bootable WinNT or Win2000 disk using XXCOPY and standard
         set of tools.  We have been asked by many users why not.
    
         Let me briefly explain what is involved in making a bootable disk. 
         The initial step in booting a Windows system is to have BIOS access
         the Master Boot Record (MBR, the first sector of the first drive),
         which determines the partition information and supplies the initial
         bootstrap program.  This very small program is then copied into the
         main memory and the processor will start executing the program.
         Normally, the MBR data is initialized by FDISK (or other specialized
         toos).  XXCOPY does not access the MBR.  That is why in the article,
         we show you when and how to use FDISK.  In the case of WinNT/2000/XP,
         the lengthy OS installation procedure writes the MBR with its own
         boot program.  So, the MBR certainly is one factor.
          
         Secondly, a handful of key files (such as \WinNT\system32\security) 
         are locked by the system while WinNT/2000/XP is running.  Since the
         system refuses to share these files with any other application,
         XXCOPY can never access these files (about a dozen or so). In the
         case of Win9x, most system files in the \Windows directory are
         accessible in read mode, and XXCOPY has no problem accessing nearly
         all of them from a Win9x session.  It is entirely possible that one
         can write an elaborate multi-step batch script to access those key
         files from DOS.  We just have not done our homework on this subject.
    
     
    Q17: Is there a way to backup a directory and keep the time-stamp of
         the source directory (and those of the subdirectories) so that
         when I restore the directory later, the time-stamps will exhibit
         the original directory-creation time?
    
    A17: If you run XXCOPY under NT/2000/XP, newly created directories in
         the destinaion will get the same timestamp.  But, under Win9x/ME,
         unfortunately no.  As far as we know, there is no File I/O API
         in the Win9x programming (or in DOS for that matter) which allows
         a program (such as XXCOPY) to set or modify the time value for
         a directory.  We feel it is a serious omission of in the Win32
         implementation.  The only ways to achieve the objective are to use
         some programming tricks.  But, possible side effects and risk of
         compromising the system integrity is too great.  It is a serious
         omission in API functionality when Microsoft implemented Win32
         for the Win9x/ME environment. 
    
     
    Q18: When I right-click the icon of the XXCOPY.EXE file and examine
         the version number, it is different from the one the program
         shows at the banner line.  Why?  And, which one to believe?
    
    A18: We have traditionally used version numbers which consist of
         four digits which are grouped in to three parts like 2.60.0.
         Unfortunately, the version information which can be attached
         to an EXE file (to be viewed in the property sheet of the
         EXE file) has a format of four digits which are always split
         into four parts of single digit.  We don't really like the
         format and we can't do anything about it.
    
         Besides, it is somewhat time consuming to set the property sheet
         version number every time we build a beta version (which are
         often made for tentative debugging purposes).  To be honest,
         more often than not, we forget spending time in adjusting the
         property sheet section while we are concentrating on removing
         bugs and making a few experiments to see a particular problem
         is gone for a user's environment.  The property sheet is just
         a distraction as far as we are concerned. 
         
         Just disregard the version number property sheet and take
         XXCOPY's banner line (which are very prominent) at its face
         value.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #14


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Tutorials in Command Line (DOS Box) Operations
    Date:    2001-09-02
    ====================================================================
    
    One of the common problems in providing a command line tool like
    XXCOPY is that many computer users now do not feel comfortable with
    non-GUI operation.  They prefer the comfort of drag-and-drop and
    mouse clicks.  While the GUI operation is certainly more intuitive
    and quicker to learn, it is not the fastest way to get job done
    when the job is to handle several thousand files in hundreds of
    directories.  And, that's what you have now in your humble disk!!!
    
    We see no substitutes for command line processing especially with
    batch file programming (or other scripting techniques) to automate
    it.  Once you have set up a well-written script with XXCOPY commands
    inside, you can make an icon for it and you will then enjoy the
    comfort of clicking the icon, sit back and relax while XXCOPY is
    doing the hard work.
    
    You should at least give yourself a chance to acquire the basic
    skill of exploiting the power of your computer (and it will remain
    with you for the rest of your life).  The basic DOS-box skill helps
    you not just for XXCOPY.  Moreover, the command line operation will
    probably be there for many more generations of operating systems
    (Win9x, NT/2000/XP/XP, and beyond).
    
    The following list is a non-exhaustive collection of pointers to
    tutorials in command line (DOS) operations. 
    
    =================================================================
    
    
    1. http://home.att.net/~gobruen/progs/dos_batch/dos_intro.html
    
           4-page series.  Step by step.  Good narrative tutorial.
    
    
    2. http://www3.sympatico.ca/rhwatson/dos7/commandintro.html
    
           Good as a reference, each command is explained with
           a dedicated page with examples.
    
    
    3.  http://teckies.com/tutor/dos/
    
           A very good site.  It is shorter than the earlier one.
    
    
    4. http://www.animatedsoftware.com/faqs/learndos.htm#cd_command
    
           This site is shorter.  Therefore, if you are in a hurry,
           this page may be good.  But, less text per command and
           that may possibly make this page harder to learn.
    
    
    5.  http://www.glue.umd.edu/~nsw/ench250/dostutor.htm
    
           Six lessons.  The page is text-only.  Looks good.
    
    
    6.  http://cs.senecac.on.ca/~ops134/resources/commandline1.htm
    
           Shortest of all.
    
    
    ===============================================================
    
    If you have seen good sites which are not listed here, please
    let us know for future inclusion in this list.
    
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #15


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Windows File Date and Time
    Date:    2000-06-07
    ====================================================================
    
    File time in DOS
    
      The good old DOS had just one file date value which keeps track of
      a file in your storage (hard disk and floppy).  To be precise, the
      value has two parts, the date part (year, month, and day) and the
      time part (hour, minute, second ---- measured in two second interval),
      but we will call it just "file date" in this discussion.
    
      Whenever a file is created, the current system time is stamped to the
      file which would remain constant even if it is copied or moved to a
      new directory.  A complete rewrite, partial rewrite, or partial
      deletion would update the file date value.  Therefore, the DOS file
      date represents the last-write (or, last-modified) time.  It was
      quite simple and well.
    
    
    File time in Win32:
    
      The new so-called Win32 environments (Windows 95, 98, NT, 2000)
      expanded the file date to hold more information about the history of
      the file.  Win32 maintains three distinct time stamps on every file.
      Inside Windows Explorer, you can examine these values in the property
      sheet for a file.
    
        1. Created:    It is the time when the file is created in the
                       current directory.  When the file is copied to a
                       new directory, a new value will be set.
    
        2. Modified:   It is the time when the file is last modified.
                       When the file is copied to elsewhere, the same
                       value will be carried over to the new directory.
    
        3. Accessed:   It is the time when the file is last accessed.
                       This value is set by the application program that
                       sets or revises the value.  Unfortunately some
                       applications do not revise this value.
    
      The file date value commonly referred to under Win32 is the "Last-
      modified" value (2nd one in the list above) whose behavior is
      consistent to the DOS file date value.  The Win32 file date values
      are stored in much finer resolution than the DOS time stamp (16 bits
      for the date and 16 bits for time).   The Win32 file date value
      is a 64-bit quantity which represents the time elapsed from
      January 1, 1601 (the first date of the current quadri-century)
      in 100 nsec granularity.  For the compatibility's sake, even WinNT/2K
      uses the same 2-second granularity for the "Last-modified" time for
      FAT-based file system (does not apply for NTFS files).
    
    
    XXCOPY's file date treatments:
    
      XXCOPY provides the following switches to select one of the
      three timestamps as the filedate value for time comparison.
    
         /FC     File-Create time
         /FW     Last-Modify (Last-Write) time (default)
         /FA     Last-Access time
    
      These switches do not perform any action by themselves.  They
      are used to modify the semantics of other switches which use
      the file date parameters in the file selection process.  For
      example, /DA and /DB are often modified by the /FC switch.
    
    
    The file date (Last-Modify date):
    
      The common file date value (more precisely, the Last-Modify-date)
      is the most intuitive and probably the easiest to use.  So, by
      default, XXCOPY's file date functions use the Last-Modify date by
      default.  For example,
    
        XXCOPY  c:\mydir\  d:\backup\  /DA#7
    
      The /DA#7 switch selects files which are last modified within
      the last 7 days.  This selection includes files which are created
      or modified elsewhere and brought to the source directory by
      either a copy or move operation.  The COPY or MOVE operations
      carried out by practically all file copy utilities (i.e.,
      Drag-and-drop, COPY, XCOPY, MOVE, or XXCOPY) preserve the file's
      Last-Modify date.
    
    
    The file creation date (File-Create date):
    
      Another useful date value is the File-Create date.  Unlike the
      Last-Modify date, this value represents the date the particular
      copy of the file is created in the directory.  Here, the meaning
      of creation includes both the case of a newly created file, and an
      existing file brought in to the directory by a copy operation.
      So, the File-Create date is often newer than the Last-Modify date.
      Note that sometimes, the "File-Create" date could be a little
      misleading.  But, in this article we use the "File-Create" date
      consistent with the way Microsoft calls it.
    
      With XXCOPY, you may use this creation-date value instead of the
      more common Last-Modify date.  Here is an example:
    
        XXCOPY  c:\mydir\  d:\backup\  /S /FC /DA:.
    
          This command copies all the files which are either made in
          or brought into their present directory today regardless of
          the age of the file.  With the /FC switch, XXCOPY uses the
          File-Create date rather than the Last-Modify date.  The
          /DA:. switch selects files of today or a future date.
    
      Since the use of the File-Create date has serious problems, we
      generally discourage the use if this date
    
    
    Problems with the file creation date (File-Create date),
    
      The problems of the File-Create date can be traced back to
      the inconsistency in Microsoft's various file management
      utilities.  It seems that the purpose of three distinct
      variations in the file date values were never clearly defined
      by the designer of the feature.  We as software developers
      have not come across any official documents on this subject.
      So, we conduct a few experiments using Microsoft's programs
      which are part of Windows 95.  Then, you will find many
      inconsistent usages in the File-Create date.
    
      Observation 1:  When you perform a copy operation of a file
                      which results in a new physical copy in the
                      destination, the File-Create date is set to
                      the current date.
    
      Observation 2:  When you move a file within a volume, the
                      operation is translated to the more efficient
                      renaming operation.  Since renaming a file does
                      not involve in a newly created file, the File-
                      Create date will not be updated.
    
      Observation 3:  When you move a file across the volume boundary
                      (e.g., from C: to D:), the move operation is
                      carried out as a file copy action followed by
                      a file delete action, the file in the new
                      location will receive a new File-Create date.
    
      Observation 4:  Edit a file using either NotePad.exe, WordPad.exe
                      or WinWord.exe (word), and save the file.  The
                      newly update file will have the same File-Create
                      date, but a new Last-Modify time.
    
    
      The inconsistencies listed above make the File-Create date unfit
      for a general-purpose file selection criterion by XXCOPY.  On
      the other hand, if you have full control of the file creation
      process in a given directory (say, you always use one of the
      file copy operations to manage files in the directory), you may
      still use it with caution.
    
    
    The case with the Last-Access date:
    
      This parameter is also a very controversial value that goes with
      every file in the Win32 system.  The Last-Access date is set whenever
      the file is "Accessed" by a program.  Then, the next question is
      what really constitutes an "Access" to a file?
    
      Is opening the file by a program, by any program, treated as an
      "Access"?  Thank God, the answer is no.  If that were the case,
      whenever the Windows Explorer displays an executable file using its
      icon (which is stored inside the file), the Last-Access date would
      be set to the current date.  That is because display of the icon
      involves fist opening the file and reading the contents to locate
      the internal icon.  In this case, although the treatment of the icon
      is rather elaborate under the cover, it is not regarded as an "Access".
      On the other hand with .EXE and .DLL files, executing the program
      constitute the Last-Access.  That makes sense.
    
      But, there are plenty of silly mistakes committed by Microsoft's
      programmers which makes the Last-Access date of little use.  The
      possibly the worst program mistake with this value is by Windows
      Explorer.
    
      As shown above, when you click the right button on an icon of a file
      and select the properties menu, you can examine the Last-Access date
      (in this case you get only the date without time) along with the other
      two file date values.  But, if you are alert, you will notice that
      the Last-Access date is always today's date.  Yes, the very act of
      examining the Last-Access date value triggers the update of the value.
      That is sad.  Very sad.
    
      When a system administrator makes a regularly scheduled backup, he
      usually performs a full backup every so often, copying every file
      in a drive.  Now, that is an act of Access.  Copying a file will
      also update the Last-Access date.
    
    
    Conclusion:
    
      If Microsoft's programmers had been very careful not updating the
      Last-Access values under certain common file access cases, this
      value could have become a very useful parameter in file selection
      for file management (backup) activities.  Unfortunately, they wrote
      so many programs that ignored the designer's apparent intention.
      Now, it is too late.  The Last-Access date is even more useless
      than the doomed File-Create date.
    
      We recommend the use of /FC (File-Create date) only in carefully
      controlled circumstances.  The Last-Access date (selected by /FA)
      seems nearly useless for meaningful file management activities.
    
      Original DOS file system had only 32 bytes to represent a file in
      the directory.  The very restrictive 8.3 filename and the limited
      granularity (2 second) in file date are corrected in the Win32
      file systems (VFAT).  But, the generous allocation of lots of
      bytes (24 bytes just to store the file date in three flavors) which
      bloats the system resource usage but provides little useful
      information seems to symbolize what we know as Windows Operating
      System.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #16


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Gathering files into one directory using XXCOPY
    Date:    2000-09-14
    ====================================================================
    
    The trouble is...
    
      Do you know approximately how many files there are on your disk?
      Many people don't have a faintest idea.  But, if you find the XXCOPY
      utility useful at all, you should check the numbers every now and then.
      By the way, in my own modest machine, the C: drive has approximately
      150,000 files in 8,000 directories totaling about 20 GB.
    
      At any rate, we all face the same headache; too many files in too
      many directories.  Finding a file now becomes a project.  We try
      hard to come up with a better tool in our losing battle.
    
    
    Search and collect files into just one directory.
    
      In many cases, collecting certain files into a directory may save a
      lot of time.  For example, if you gather all Microsoft Word document
      (.DOC) files from the entire volume into just one subdirectory,
      browsing them and locating a particular file become much easier.
      That is what XXCOPY's /SX, /SG and their variations are for.
    
      The traditional way to do this is (don't type beyond the comment //... ),
    
         XCOPY  C:\*.doc  D:\mydocs\   /S       // using Microsoft's XCOPY
         XXCOPY C:\*.doc  D:\mydocs\   /S       // the same here with XXCOPY
    
           The /S switch makes the copy operation to recursively
           go inside subdirectories and copy all matching files.
           If subdirectories are not present in the destination,
           they will be created as needed.
    
           ----------------------------------------------------------
             Note that the destination directory was deliberately
             chosen in a different drive in the examples above.
             Watch out if the destination is in the same volume...
    
               XCOPY  C:\*.doc  C:\mydocs\   /S       // a FATAL error
               XXCOPY C:\*.doc  C:\mydocs\   /S /CCY
    
             This is a classic case of the cyclic copy situation which
             Microsoft's XCOPY cannot handle.  Using /CCY, our XXCOPY
             allows you to specify the destination in the same volume.
             See XXTB #07 for detail.
           ----------------------------------------------------------
    
         Although the files you wanted are all copied into the destination,
         the destination directory will inevitably have many subdirectories
         which makes your next step still very time-consuming.
    
    
    XXCOPY provides better solutions.
    
      XXCOPY has a better way to deal with the situation that avoids making
      subdirectories in the destination.  Of course, it is inevitable that
      many files share the same filename.  So, XXCOPY synthesizes new
      names when duplicate files are to be copied into the destination.
    
         XXCOPY C:\*.doc  D:\mydocs\   /SX
         XXCOPY C:\*.doc  D:\mydocs\   /SG
    
      Our original directory-flattening functions (/SX, /SL and /SR) combine
      the source directory path (only the distinguishing part) with the
      source filename to form a long filename which is always unique
      (and you can tell where the files are from).
    
          /SL     Flattens subdirectories, add-name-Left
          /SX     Flattens subdirectories, add-name-Middle
          /SR     Flattens subdirectories, add-name-Right
    
      By popular demand by XXCOPY users, we re-engineered the new file-gathering
      functions /SG and its variations which retain the original filename.
    
          /SG     same as /SGN (newest one and sorted by newness)
          /SGN    sorted, newest file first
          /SGO    sorted, oldest file first
          /SGF    unsorted, first come first served
    
          /SGNO   picks the newest file
          /SGOO   picks the oldest file
          /SGFO   picks the first file encountered
    
      That's a total of nine flavors to choose from!  Our favorite is /SGN
      which got the honor of being equivalent to its shorter version, /SG.
    
    
    The /SX (/SL or /SR) switch flattens a directory.
    
      To understand how these schemes work, it is easiest to actually
      run the command and take a look at the destination directory.
      Let us start with the directory-flattening functions.
    
        XXCOPY C:\*.doc  D:\mydocs\   /SX     // puts path in the middle
    
           The result would be
    
           D:\mydocs\MYFILE`My Documents`word`.DOC
           D:\mydocs\MYFILE`Junk`Vote2000`gore`.DOC
           D:\mydocs\MYFILE`Junk`Vote2000`bush`.DOC
           D:\mydocs\MYFILE`Junk`Vote1996`dole`.DOC
               ...
    
         The four MYFILE.DOC files are collected from four directories.
         In this case, the backslash (directory name delimiter) is converted
         into a legal character which is infrequently used in filenames
         (default = back-apostrophe (`)).  (See below to select the directory
         name delimiter character other than the default character).
    
         The /SL and /SR variations respectively place the pathname part
         either at the left or at the right of the filename.  We like the
         /SX version the best among the three variations because the new
         filename starts like the original and the ending also remains
         the same so the Windows knows which application to associate
         the file when you double click the file icon.
    
    
    The /SG switch gathers files into a directory.
    
      All the file-gathering functions (/SG and its variations) work
      identically if there is only one file for a given filename.
      The switches with O (not zero, but Oh) at the end keep only one file
      Newest, Oldest, or the First one found) for a given filename.
    
      On the other hand, other /SG functions have to gather all files
      with the same filename into one directory.  Therefore, we need to
      synthesize the filenames for the duplicates.  XXCOPY simply adds
      a "middle name" to the filename.  For example,
    
    
         XXCOPY C:\*.doc  D:\mydocs\   /SG     // sort, newest file first
    
           The result would be
    
           D:\mydocs\MYFILE.DOC                // the newest file
           D:\mydocs\MYFILE.0001.DOC           // 2nd newest
           D:\mydocs\MYFILE.0002.DOC           // 3rd newest
           D:\mydocs\MYFILE.0003.DOC           // 4th newest
              ...
    
    
      These functions are fun to play with.
      For example, just see how many .JPG (image) files are on your system
    
          XXCOPY C:\*.jpg  C:\temp\   /SG /CCY
    
          You may be surprised how much space is tied up with them.
          This particular example may become your favorite tool to
          snoop your children's computer for questionable pictures!!!
    
    
    Reversal of flattening = rebuilding the tree.
    
      With regard to the difference between /SX and /SG, for a casual and
      temporary usage, the /SG switch seems easier for most people.  The
      most important difference of the two approaches is that the /SX (and
      also /SL and /SR) switch synthesizes the new filename without losing
      the origin of the file.  As a matter of fact, XXCOPY provides the
      following three switches which allow you to rebuild the original
      directory structure from the destination (flattened) directory.
    
          /SLR   Rebuild the original directory from directory made by /SL
          /SXR   Rebuild the original directory from directory made by /SX
          /SRR   Rebuild the original directory from directory made by /SR
    
          Note that these switch must match the way the flattened directory
          was made.  For example if you flatten a directory using /SL, you
          must use /SLR and so on.  Also, the directory name delimiter
          character must be consistent between the flattening and the
          rebuilding steps.
    
    
          Examples:
    
               XXCOPY C:\word\*.doc  D:\mydocs\   /SX        // flattens
               XXCOPY D:\mydocs\     C:\word2\    /SXR       // rebuilds
    
             The ultimate destination directory (C:\word2\) would contain
             the same files and subdirectories as in the above two steps
             when you run the following command which copies the files
             to the destination directly.
    
               XXCOPY C:\word\*.doc  C:\word2\    /S
    
    
    About the directory name delimiter character.
    
      The directory name delimiter can be any legal non-alphabetic,
      non-blank character.  The following line lists all such characters:
    
              !  #  $  %  &  '  (  )  -  .  @  ^  _  `  {  }  ~
    
          Since many of them are frequently used in common English usage
          and therefore likely to appear in filename, the choice for the
          default delimiter character (the back-apostrophe character `)
          was chosen.  The next good candidate is probably the caret symbol (^).
          The trouble here is that the character used as the substitute for
          the backslash character must be a legal character for a filename,
          therefore, it is inevitable that the chosen delimiter may already
          be a part of existing filename.  In such unfortunate cases, the
          directory name which would be rebuilt from the synthesized name
          would not be identical to the original path, a small inconvenience.
    
    
    Final note.
    
      Lastly, let me remind you that gathering files into a directory
      is nice, but that contributes to yet more redundant files.  So, make
      sure that you remove all the files you collected for a temporary
      purpose as soon as you are done with them.  One way to deal with
      it is to always use the same one directory for temporary jobs.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #17


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: Selecting files by file date amd time using XXCOPY
    Date:    2001-02-23  (revised)
    ====================================================================
    
    Introduction
    
      The filedate value offers yet another trait to select files for
      various file management operations.  Microsoft's XCOPY allows you
      to specify a cut-off date to select some recently created files.
      Our XXCOPY, on the other hand, seizes the opportunity with respect
      to the filedate (and time) to a much greater extent for qualifying
      files for a large collection of functions.
    
      While the fundamental elements of filedate-related operations are
      quite simple, the total number of variations may be daunting
      to some users.  So to ease the pain of memorizing the details,
      here in this article, simpler things are presented first, followed
      by more complicated aspects.
    
    
    The file date/time related XXCOPY switches.
    
      The ten basic filetime switches fall into either of the two groups:
    
        Comparison to the reference file (newer/older/same/different)
    
            /DA,  /DB,  /DS,  /DX         ; newer, older, same, different
    
        Relative and Absolute date specifiers (you give the range of date)
    
            /DA#n,    /DB#n,    /DO#n     ; as how many days ago from today
            /DA:date, /DB:date, /DO:date  ; date specified as yyyy-mm-dd
    
    
    Comparing the filetime of two files
    
      The filetime comparison switches are used mainly for directory
      synchronization and various backup operations based on file time.
      Therefore, in all cases, the file time comparison is made on a
      pair of files; one from the first (source) directory, and the other
      from the second (destination ,or sometimes reference) directory.
    
      In this case, the pair of files are compared not only by the
      filedate, but also by the file time to the finest value (hour,
      minute, and second) (see below for /FT for details).  Since the
      comparison is made on the file time value which are stored in
      the respective directory, the XXCOPY user does not specify the
      value and therefore, the command syntax for these switches are
      the simplest; /D, /DA, /DB, /DX, /DS without any user-specified
      parameter.
    
         /D   Same as /DA
         /DA  Copies newer files and brand new files.
         /DB  Copies older files and brand new files.
         /DX  Copies different-date files only.
         /DS  Copies same date/time files only.
    
    
    Testing file's date against a user-specified date range
    
      Unlike the file time comparison method presented in the preceding
      section, XXCOPY allows you to select files based on the filedate
      associated with each file which are expressed in either the relative
      date (how many days ago from today), or the absolute date (specified
      in year, month and day).  For this feature, XXCOPY maintains one
      or two dates to qualify files for file management operations.
    
         "A-date value" for On-or-After date  (entered by /DA: or /DA#)
         "B-date value" for On-or-Before date (entered by /DB: or /DA#)
    
    
      The relative date specifiers
    
          System administrators often refer to a group of files by the age
          of the files for backup operations.  One of the most natural ways
          of specifying them is the file age measured in days (relative to
          the current 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.
    
    
          Examples of command lines using the relative date:
    
            XXCOPY  src  dst  /DA#60            // After 60 days ago
            XXCOPY  src  dst  /DB#30            // Before 30 days ago
            XXCOPY  src  dst  /DA#60  /DB#30    // files with age of 30-60 days
            XXCOPY  src  dst  /D#100            // same as /DA#100
    
          As you can see from the examples, you may specify only one of
          the "A-date value" and "B-date value" or both.  If you specify
          only one date value, then the other end is open-ended.
    
          Note that the file age is measured by the number of days starting
          0 (zero) as the value for files made today, 1 (one) for files made
          yesterday, and so on.
    
          When you specify both the "A-date value" and "B-date value", the
          date range you specify may be used for an inclusive selection or
          exclusive selection, depending on which of the two values are newer.
          The following examples illustrate this point more clearly.
    
            XXCOPY  src  dst  /DA#60  /DB#30    // files with age of 30-60 days
            XXCOPY  src  dst  /DB#60  /DA#30    // age >= 60 or age <= 30
    
            Here, two same date values are specified for the opposite
            /DA: and /DB: switches.  The first example is the most common
            case where the two dates specify the beginning and the end of
            a single period.  On the other hand, the second example shows
            different case where the two date are applied toward the
            opposite direction in the timeline which in effect excludes
            files in the excluded period (files with age 31-59 days are
            NOT selected) --- such a case is accepted as a valid command.
    
          Note that when the age is referred to by the number of days,
          it is not measured by the multiple of 24 hours.  Rather, the 0th day
          (today) began at midnight today to take care any fraction of today.
          That is, /DA#0 specifies the files made on or after midnight today.
          This scheme allows the cut-off time to be midnight of each day.
    
    
      The relative time specifiers
    
          The relative time specifier adds few more twists to the relative
          date specifier.  In the /DA#n  /DB#n or /DO#n switches, when the
          age value n is given as a number without a suffix, the age will
          be measured by number of the days.  This is probably most common
          usage.  But, you may add a single-letter suffix (D, H, M, or S)
          to the value (for Days, Hours, Minutes or Seconds, respectively).
    
          Examples:
    
            XXCOPY  src /S /LDT /DA#30M   // list files made within 30 min.
            XXCOPY  src dst /s  /DA#24H   // copy files made within 24 hours
            XXCOPY  src dst /s  /DA#0     // copy files made today (since midnight)
    
    
      The absolute date specifiers
    
          Since we reference dates by year, month and day quite often in
          our day-to-day lives, it is also very natural for us to specify
          the file time as such.
    
          /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.
    
    
          Examples of command lines using the absolute date:
    
            XXCOPY  src  dst  /DA:2000-1-1
            XXCOPY  src  dst  /DB:1999-12-31
            XXCOPY  src  dst  /DA:1998-1-1 /DB:2000-8-31
            XXCOPY  src  dst  /D:1998-1-1              // same as /DA#1998-1-1
    
    
      Now, you already know the essential mechanism of XXCOPY which controls
      file selection based on the filedate.  Nearly all of the remaining
      discussion is for various shortcuts and clarifications of details.
    
    
    The "O-date value" for the same parameter
    
      When the "A-date value" is the same as the "B-date value" (to specify
      a particular date), you may use the third way, the "O-date value" to
      combine the two into one parameter.
      You can use the "O-date value" (On the date) whenever the "A-date value"
      and the "B-date value" are the same.  (Here, the letter O (oh, not zero)
      is shown in lowercase (o) to avoid confusion.)
    
          The following two commands are equivalent:
    
            XXCOPY  src  dst  /DA:2000-5-1 /DB:2000-5-1
            XXCOPY  src  dst  /Do:2000-5-1
    
         It also applies to the relative date specifier.  The following
         two commands are equivalent.
    
         XXCOPY  src  dst  /DA#80 /DB#80
         XXCOPY  src  dst  /Do#80
    
    
    Shortcut for Today and Yesterday
    
      One of the most common date used with XXCOPY is the current date
      (today) and one day earlier (yesterday).  So, we assign the dot (.)
      parameter as a shortcut for today's date for the /DA and /Do switches,
      and as a shortcut for yesterday's date for the /DB switch.
    
          /DB:. or /DB#.  specify filedate date is Yesterday or earlier.
          /DA:. or /DA#.  specify filedate that is today or later.
          /Do:. or /Do#.  specify filedate that is today only.
    
    
    Partial date specifiers
    
      You may specify a month by omitting the day-of-the-month value.  If
      only two numbers are given, one must be a 4-digit year value.  The
      following command lines all specify the entire month of February, 2000.
      The "B-date value" in this context specifies the last day of the
      month, and the "O-date value" in this context specify the whole month.
    
         XXCOPY  src  dst  /DA:2000-2-1 /DB:2000-2-29
         XXCOPY  src  dst  /DA:2000-2   /DB:2000-2
         XXCOPY  src  dst  /Do:2000-2
    
      Similarly, you may specify the filedate by the year.
      The following three cases are equivalent.
    
         XXCOPY  src  dst  /DA:2000-1-1 /DB:2000-12-31
         XXCOPY  src  dst  /DA:2000     /DB:2000
         XXCOPY  src  dst  /Do:2000
    
      The partial date specifiers that are shown so far are for the cases
      of the whole month and the whole year.  But, the usage of partial date
      specifier is not limited to such cases.  When it is used for the
      /DA parameter, the partial date value specifies the first day of
      the month/year.  When it is used for the /DB parameter, it denotes
      the end of the month/year.  And, when it is used for the /Do
      parameter, it selects the whole month/year.  Here are some examples.
    
         XXCOPY  src  dst  /DA:1999-4           // same as /DA:1999-04-01
         XXCOPY  src  dst  /DA:1998             // same as /DB:1998-01-01
    
         XXCOPY  src  dst  /DB:2000-5           // same as /DB:2000-05-31
         XXCOPY  src  dst  /DB:1998             // same as /DB:1998-12-31
    
         XXCOPY  src  dst  /Do:2000-2           // the month of Feb, 2000
         XXCOPY  src  dst  /Do:2000             // the whole year 2000
    
         XXCOPY  src  dst  /DA:1998-4 /DB:1999  // /DA:1998-04-01 /DB:1999-12-31
    
    
    Odd cases:
    
       The relative and absolute date specifiers can be mixed in a command.
       Although most users avoid mixing the two types of expressing the
       date value, there is nothing inherently wrong about using both the
       relative and absolute date specifiers.
    
           XXCOPY  src  dst  /DA:2000-1-1  /DB#7
    
           This example specifies files that are at least one week old
           which are made in the year 2000.
    
       You cannot specify two periods in timeline in one XXCOPY command.
       That is, XXCOPY maintains one "A-date value" and one "B-date value".
       If you specify two A-date values, the first such value will be
       discarded.
    
    
    International conventions
    
       We endorse the ISO-8601 convention (DMXXTB #025) which denotes the date/time value in
       the most logical order.  But, XXCOPY also accepts other conventions
       if the date value is unambiguously specified.  It allows one of the
       three (ISO, US and EU) conventions to be used for an absolute date
       specifier as long as it is value is unambiguous.  For example,
    
           /DA:2000-01-02      // ISO  the first value is larger than 1970
           /DA:0-1-2           // ISO  0 (for 2000) cannot be for month or day
           /DA:12-13-2000      // US   the value 13 cannot be a month value
           /DA:01-13-01        // US   the only one to have 13 in the middle
           /DA:13-10-2000      // EU   the value 13 cannot be a month value
    
        This applies to the partial date specifiers.  Therefore, both
        /DA:2000-03 and /DA:03-2000 are accepted as equally unambiguous.
    
        But, when there are more than one way to interpret the date value,
        the system's date format setting will be used to resolve ambiguity.
        The following date specifiers are such ambiguous cases and we
        suggest you avoid these cases.
    
           /DA:1-2-3           // can be ISO, US, or EU;  pretty bad
           /DA:12-12-12        // can be ISO, US, or EU
           /DA:1-2-2000        // can be US or EU
           /DA:11-12-13        // can be ISO, US, or EU
           /DA:13-12-11        // can be ISO, or EU
    
        I hope by now, you are convinced of the superiority of the ISO
        notation which also gives you the convenience of easy sorting.
    
        In the case of the partial date specifier, the year value must
        always be in a full 4-digit value.  In this case, the order of
        the year and month value can be switched without causing any
        ambiguity.  For example;
    
           /DA:2000-01         // partial ISO notation
           /DA:12-1999         // US/EU
    
    
    File time-related switches
    
      All file time related functions can be further modified by various
      switches to meet your specific needs which may be different from
      the majority users.
    
    
      /FW, /FA, /FC (Last-Written, Last-Accessed, Created)
    
        Under normal circumstances, the file date/time XXCOPY uses is the
        time the file was last written (the commonly used file time value,
        /FW as the default), it can be substituted by the last-accessed
        time (/FA) or file creation time (/FC).
    
      /FL, /FU (Local time, UTC time)
    
        The commonly used file time is expressed by the local time (/FL
        as the default).  However, in networking environment, it may be
        more convenient for some users to enter the file time using the
        UTC time (/FU) which is also known as GMT (Greenwich Mean Time).
    
      /FT (File time truncation)
    
        When file time is compared against one another in a mixed OS
        environment, the granularity of the file time stamp (which is
        usually set by the particular file system) may cause problems.
        For example, the FAT based file systems (FAT12, FAT16, FAT32)
        uses file time which is measured by two second interval whereas
        unix-based file system uses one second interval. The NTFS uses
        much finer file time.  The /FT switch forces XXCOPY to truncate
        a file time to the coarsest (two second interval) unit before
        file times are compared.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #18


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: The filename matching schemes in Win32 and DOS
    Date:    2009-02-10  (revised with a new subject)
    ====================================================================
    
    Longname revisited
    
      When Microsoft introduced the long filename to the Windows operating
      systems (Windows 95, 98, ME, NT4, and 2000), the legacy file access
      method using the shortname alias (the so-called 8.3 format) had to
      be supported.  Having two names for an object solved many problems.
      Yet, it also created a few undesirable side effects, albeit they
      are rather subtle.
    
      The most notorious aspect of the dual identity for the file and
      directory, is probably the synthesized shortname when a file is
      copied.  XXCOPY's /NX switch (by default) solves most of this
      problems by preserving the shortname.
    
    
    The filename matching schemes (Loose name-matching)
    
      A close examination of the behaviors of Microsoft's XCOPY utility
      with regard to the filename matching function reveals an interesting
      but potentially troubling implementation.  That is, the filename
      matching in XCOPY (as well as the DIR command) is performed on both
      the longname and the shortname.  When either of the names matches
      the filename template, the file is selected.
    
      Say, you have a file \src\longname5.txt (shortname LONGNA~1.TXT).
    
      When you use Microsoft's file utilities such as the DIR, COPY,
      or XCOPY commands in the Win32 environment, the file can be
      accessed in any of the following commands,
    
         DIR     \src\*5.txt
         DIR     \src\*1.txt
         COPY    \src\*5.txt
         COPY    \src\*1.txt
         XCOPY   \src\*5.txt
         XCOPY   \src\*1.txt
    
      So, in the Win32 environment, a filename pattern applies to both
      the longname and the shortname.  Our XXCOPY supported the loose
    
    
      Now, try the following commands:
    
         DIR     c:\windows\system32\*1.dll
         XCOPY   c:\windows\system32\*1.dll    c:\temp1\
         ROBOCPY c:\windows\system32\ *1.dll   c:\temp2\
    
      You may be surprised that some of the files chosen do not have
      the filename pattern you specified.  A close examination of
      the source directory (try the DIR /X command) reveals that those
      files in question have a SFN like MICROS~1.DLL that matches the
      pattern.
    
       ----------------------------------------------------------------
        Our XXCOPY supported the loose name-matching scheme until
        ver 2.97.8.  However, as the number of files in a directory
        has been steadily growing, the chances of encountering an
        inadvertent match to the short (8.3) name has also lately
        become a very serious issue.  With the demise of XCOPY
        (that is no longer supported by Microsoft), it is time for
        us to stop honoring the mindless compatibility in this regard. 
        See below for details.
       ----------------------------------------------------------------
      
    
    The /N switch of XCOPY
    
      Presumably, the idea behind the /N switch of Microsoft's XCOPY
      utility is to emulate the DOS (real mode) environment by handling
      the filename by the shortname (8.3) format.  Indeed, when files
      are copied, the destination will only have the shortnames.
      But, Microsoft programmed XCOPY's filename matching to behave
      identically whether or not you specify the /N switch.
    
      Let's look at the following lines for the two files listed above.
    
         XCOPY   \src\*1.txt   /N
         XCOPY   \src\*5.txt   /N
    
         XXCOPY  \src\*1.txt   /N
         XXCOPY  \src\*5.txt   /N
    
      In either case, the file, LONGNA~1.TXT will be copied into the
      destination.
    
    
    Enter the /NP (Precise name-matching) switch
    
      As discussed above, a filename pattern is typically matched
      to both the long name and the short name with most of application
      programs in the Windows environment.  This is due to the fact
      that most applications simply use library functions supplied
      by Microsoft.
    
      Due to the significant increase in the probability of inadvertent
      (and often unnoticed) matches with the short name when the total
      number of files in a given directory becomes very large (say,
      a few thousand files), it became unacceptable for XXCOPY to
      maintain the compatibility in its file-matching behavior to
      Microsoft's products.
      
      In order to retain a full control of the name matching operation,
      XXCOPY offers you an option on this issue:
      
        /NP      // Enables Precise Name-matching
        /NP0     // Disables Precise Name-matching
    
    
      --------------------------------------------------------
       With versions v2.97.8 or earlier, XXCOPY's default
       name-matching scheme was compatible with Microsoft's
       Loose name-matching scheme (/NP0).
    
       Starting with v.2.97.8, XXCOPY reversed the default
       and now uses the "Precise name-matching" scheme (/NP)
       by default.
    
       In practice, you hardly ever need the /NP0 operation.
       After all, Microsoft's Loose name-matching is madness.
      --------------------------------------------------------
      
    
    The relationship between the /N and /NP switches.
    
      The /N function forces XXCOPY to view and treat files using
      the short (8.3) names only.  Therefore, even though the /NP
      switch that operates independently with the /N switch, when
      when the /N switch is in effect, the /NP switch setting becomes
      irrelevant.  That's because with /N, the file-selection
      mechanism no longer uses the dual-name matching scheme.
      
      In short, with /N, the distinction between /NP and /NP0 is moot.
    
    
    Wildcards: the DOS-way and the Win32-way.
    
      With the longname in the Win32 environment, came the new filename
      matching algorithm which accommodate the new reality.  But, the
      reality is not very clean when you take a closer look.
    
         For example,try Microsoft's XCOPY with "very_long_name.html"
    
         XCOPY  ????????.htm  // 8 characters before the dot
         XCOPY  ????.???      // 3 characters after the dot
    
         Notice that the filename has 14 and 4 character before and after
         the dot respectively.  But, both of the above command line
         succesuflly matches the file and proceeds.  This is in Win32!!!
    
         The following command lines using Microsoft's XCOPY behave
         differently depending on the DOS/Win32 environments.
    
         XCOPY   AB*XYZ.??    // In DOS, ABCDEFGH.OK and ABCDXYZ are copied.
         XCOPY   AB*XYZ.??    // In Win32, neither of them is copied.
    
         Our XXCOPY/XXCOPY16 faithfully imitates the behavior of XCOPY
         (to do otherwise would make the user even more confused).
    
         There are many other cases which cause unwelcome surprises...
    
      We expect many system administrators find themselves in both the
      DOS and Win32 environments from time to time and choose the
      appropriate version (XCOPY16 or XXCOPY) accordingly.  So, having
      two sets of file-matching rules is last thing the users need.
      This is especially true with XXCOPY which now has a lot more cases
      of filename matching situations:  the Wild-Wild-Source, the
      exclusion specifiers, and the inclusion specifiers (e.g., alternate
      filename templates).
    
    
    Enter the /NW and /ND switches:
    
      With both XXCOPY and XXCOPY16, you have full control of the
      algorithm on filename matching with wildcards.
    
        /NW     Win32-scheme in filename matching (default in XXCOPY)
        /ND     DOS-scheme in filename matching   (default in XXCOPY16)
    
    
        With XXCOPY (Win32 version)
    
          In the case of XXCOPY, you may combine this switch with other
          filename-related switches (/NP /N /NX).  In most situations,
          the best choice for XXCOPY is /NW/NP/N0/NX (which is the plain
          defaults).  You may use /NW and /N combination which applies
          the Win-32 wildcard matching scheme to the shortname.
    
          Note the use of /ND (DOS-way) forces the /N switch enabled.
    
        With XXCOPY16 (DOS version)
    
          Note that the most recent version of XXCOPY16 we released
          was ver.2.93.1 published in 2006.  So, in all versions of
          XXCOPY16, the default name-matching scheme was /NP0.
    
          In the case of XXCOPY16, you don't have other choices in
          filename handling.  Due to the operation environment, it
          the following switches are not supported by XXCOPY16:
    
          /N  /N0    // shortname/longname access scheme (always /N)
          /NP /NP0   // loose/precise filename matching  (always /NP)
          /NX /NX0   // does not support longname        (always /NX0)
    
          Note that here with XXCOPY16, in the 16-bit DOS environment,
          you can use the more advanced (preferred) wildcard treatments
          by choosing /NW even though the underlying filename is still
          in the short (8.3) format.  This is in contract to the fact
          the opposite is not true that XXCOPY, the 32-bit version,
          cannot select /ND switch for longname (/N0) format.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #19


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY in batch files
    Date:    2000-12-31  (revised)
    ====================================================================
    
    Introduction:
    
        XXCOPY as a general purpose file management tool, works well
        as a hand-typed command in a DOS Box.  It is also a useful
        building block of a complex task written as a batch file
        for a job like a full system backup, daily incremental backup
        as well as a specialized project archiving.  In these cases,
        the whole job is made of a series of XXCOPY commands since
        XXCOPY is better suited to handle one directory (and its
        subdirectories) at a time.  It is not uncommon that a well-
        written batch file  for a backup job consists of ten or more
        lines of XXCOPY commands.
    
        Since XXCOPY plays an important role in batch programming,
        mastering its command switches which are designed for such
        purposes will help you write better batch files.  The switches
        that are particularly useful inside a batch file are:
    
           /YY /CB /CBQ /CE /EC /IA /IP
    
    
    How to get rid of the Y/N prompt.
    
        This is probably the most frequently asked question with
        regard to batch files.
    
        -------------------------------------------------------------
         The following command shows the switches which prompt you.
    
             XXCOPY /YY /?
        -------------------------------------------------------------
    
        XXCOPY provides various switches to suppress specific
        user prompts.  For example, /ZY is a variation of /Z
        which does not produce user prompts and good for batch
        file.  Similarly, /PD0 suppresses a user prompt for
        directory processing (mostly for deletion).  But, it becomes
        a hassle even to an experienced XXCOPY users.  Yes, XXCOPY
        has grown to be a monster with so many switches, you just
        can't remember all.  So, we now have an all-purpose prompt
        buster switch, /YY (super-YES).
    
        -------------------------------------------------------------
         Note:  although the use of /YY is very convenient to remove
                the various warning prompts, it is recommended only
                in well-tested batch files where any typing error
                would not cause any serious damage.
     
           E.g. XXCOPY  %1  %2  /CLONE /YY
      
                This is probably the worst place to use the /YY
                switch.  A user-supplied parameters (%1 and %2)
                in a batch file make the command is susceptible to
                human error.
                
                Just remember that the various warning prompts are
                there for good reason.  Using the /YY switch, you
                are denying yourself benefit of the safeguard.
        ------------------------------------------------------------
    
    Example of a standard batch file.
    
        Advanced batch programmers test the exit code (ERRORLEVEL)
        returned by a program and branch off if certain conditions
        are met (e.g., terminate when a fatal error occurs).  Due to
        the severe limitation in the batch language, a typical batch
        file with conditional branching usually looks quite unsightly.
    
          ------------------------------------------------------
           XXCOPY c:\windows\  d:\backup\windows\   /S /Y
           IF ERRORLEVEL 100 GOTO step2
           IF ERRORLEVEL 1   GOTO end
           :step2
           XXCOPY c:\mydir\    d:\backup\mydir\     /S /Y
           IF ERRORLEVEL 100 GOTO step3
           IF ERRORLEVEL 1   GOTO end
           :step3
           XXCOPY c:\yourdir\  d:\backup\yourdir\   /S /Y
           IF ERRORLEVEL 100 GOTO step3
           IF ERRORLEVEL 1   GOTO end
           ...
           :end
          ------------------------------------------------------
    
        Here, the ERRORLEVEL returned by XXCOPY is tested for both
        the lower and the upper bounds to perform the conditional
        branching.  Most of the typing is consumed for the error
        handling.  It takes a lot of self discipline to write a good
        bath file with proper testing.
    
        By the way, a list of the exit code generated by XXCOPY can
        be viewed by running the following command:
        
            XXCOPY  /HELPE
    
        Also see article: XXTB #31, about Exit Code.
    
    
    Using the /CB switch, the same sequence becomes...
    
          ------------------------------------------------------
           XXCOPY      c:\windows\  d:\backup\windows\   /S /Y
           XXCOPY /CB  c:\mydir\    d:\backup\mydir\     /S /Y
           XXCOPY /CB  c:\yourdir\  d:\backup\yourdir\   /S /Y
           ...
           :end
          ------------------------------------------------------
    
        In this alternative batch file, the IF ERRORLEVEL... lines
        are eliminated by the use of the /CB switch (except the first
        line).  The /CB switch which stands for "Continue-Batch"
        examines the exit code returned by the previous execution of
        XXCOPY and immediately terminates the current execution if
        the previous error condition was fatal (such as disk-full,
        or a user-abort).  How does one instance of XXCOPY know
        the exit code of its previous run?  Simple.  XXCOPY stores
        its exit code in the system registry for its own retrieval
        later.  Notice that there is no awkward branching in the
        batch file.  Actually, the exit code of one XXCOPY is NOT
        examined by the batch execution mechanism.  Therefore, the
        flow of the batch file is always to execute all the lines
        in the file.  The /CB switch provides a mechanism where a
        fatal error reported by one XXCOPY instance will propagate
        through the rest of the batch file execution that all
        subsequent XXCOPY lines with the /CB switch will be nullified.
    
        Note:  The position of the /CB switch within the command
               line is not significant.  Because of it's early action,
               it seems most appropriate to place it early on the line.
    
    
    /CBQ for a cleaner screen when the batch file is aborted.
    
        Actually, /CBQ (the quiet version) is preferred by most
        users since this version will keep the console screen
        much cleaner when it is combined with a "ECHO OFF"
        statement in the batch file.
    
          ------------------------------------------------------
           @ECHO OFF
           XXCOPY       c:\windows\  d:\backup\windows\   /S /Y
           XXCOPY /CBQ  c:\mydir\    d:\backup\mydir\     /S /Y
           XXCOPY /CBQ  c:\yourdir\  d:\backup\yourdir\   /S /Y
           ...
           :end
          ------------------------------------------------------
    
        The virtue of running the batch file with the ECHO OFF
        setting is that the XXCOPY lines subsequent to a fatal error
        of an XXCOPY will not clobber the screen.  The last XXCOPY
        line with the error message will not be pushed off the screen
        with echoed command lines even though they terminate immediately.
    
                ---------------------------------------------------------
                 What does the @ECHO OFF statement do?
    
                 ECHO OFF inside a batch file turns off the display
                 of the command line (the current line in the batch
                 file.  Without it, every line in the batch file will
                 appear on your console.  An at sign (@) at the beginning
                 of a line in a batch file turns off echoing just one
                 line (You may add an at sign (@) on every line to have
                 the same effect as ECHO OFF.  The first at sign (@) in
                 the first line suppressing the echoing of its line, too.
                ---------------------------------------------------------
    
    
    /EC and /CE for even a better batch file.
    
        The problem of running the batch file with ECHO OFF mode
        is that the screen will not show the command invocation.
        What we really want is to generate no output to the console
        when XXCOPY is terminated by the /CB mechanism but to echo
        the invocation line if it will continue the execution.
        That is what /EC (to echo the command line) does.  Moreover
        the /CBQ/EC combination is so handy in a batch file, XXCOPY
        assigns a new switch, /CE as the shortcut for /CBQ/EC.
        So, rewriting the same batch file, it should look like
    
          ------------------------------------------------------
           @ECHO OFF
           XXCOPY /EC  c:\windows\  d:\backup\windows\   /S /Y
           XXCOPY /CE  c:\mydir\    d:\backup\mydir\     /S /Y
           XXCOPY /CE  c:\yourdir\  d:\backup\yourdir\   /S /Y
           ...
           :end
          ------------------------------------------------------
    
        Note that it is not a typo!  The first line uses /EC (echo)
        and the other lines are with /CE (shortcut for /CBQ/EC).
        It looks symmetrical and even cute.
    
    
    Using XXCOPY macro to create a unique destination.
    
        When you create a batch file for a periodic (daily) backup,
        you may want to encode the current date (today) as a part
        of the destination directory name you create.  XXCOPY's macro
        reference feature (/$xxxx$) was designed exactly for that.
    
        For example, when you can enter
    
            XXCOPY C:\  D:\mybackup\DB/$YYMMDD$\  /CLONE
    
        and it will be expanded to
    
            XXCOPY C:\  D:\mybackup\DB011225\     /CLONE
    
        (assuming the current (today's) date is December 25, 2001.)
        See article: XXTB #24, about Macros.
    
    
    Testing if a directory exists
    
        The following sequence is a well established technique to
        test whether or not a directory exists in a batch file.
    
          ------------------------------------------------------
           IF EXIST d:\backup\mybackup\nul goto next
           XXCOPY c:\  d:\backup\mybackup\ /CLONE
           :next
          ------------------------------------------------------
    
        The IF EXIST (and IF NOT EXIST) construct is good only for a
        file, not a directory.  Here, the neat trick is based upon the
        fact the virtual file, "NUL" is guaranteed to exist on any
        directory.
    
        Now, using XXCOPY'S /IA (which stands for "If Absent"),
        the same command line will be re-written as
    
          ------------------------------------------------------
           XXCOPY c:\  d:\backup\mybackup\ /IA /CLONE
          ------------------------------------------------------
    
        The /IA switch continues to run only if the destination directory
        is absent (that is, /IA will terminate immediately if the
        destination exists).  It is equivalent to the "IF NOT EXIST"
        construct in the batch file.  On the other hand, /IP (If Present)
        continues to run only if the destination is present (that is,
        /IP will terminate immediately if the destination does not exist).
        it is exact opposite of /IA.
    
    
    Testing a directory using macro.
    
        The power of /IA and /IP becomes even more evident when you use
        a destination directory which is specified by a macro reference.
    
          ------------------------------------------------------
           XXCOPY c:\  d:\backup\DB/$YYMMDD$\ /IA /CLONE
          ------------------------------------------------------
    
        In this case, it's not a matter of making the batch file shorter
        and prettier.  There is no simple way to test the presence or the
        absence of a directory whose name is "synthesized".
    
        This command executes only when the directory is absent.
        This technique prevents running the same daily backup routine
        twice on the same day.
    
    
    

    XXCLONE
    [ Back to Table of Contents ] [ << ] [ >> ]

    XXCOPY TECHNICAL BULLETIN #20


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: More on Directory Cloning using XXCOPY
    Date:    2000-10-31
    ====================================================================
    
    The topics included in this page were originally in the Disk Cloning
    article XXTB #10.  Since most first-time visitors want to learn the simple
    disk clone operation and tend to be in a hurry, I decided to do them
    a favor by removing much of the variations and related materials from
    the page and keep the other article focused on the disk clone case
    only.  Here, a few variations which are related to the /CLONE switch
    are discussed.
    
    
    1.  Partial Disk cloning (bootable):
    
        This is a variation of the first one (Full Disk Cloning).
        It copies the minimum set of files into the new disk so that
        the new disk will become a bootable disk.  You may selectively
        add more directories and files if you want.  Here, the windows
        directory is assumed to be named C:\Windows (this is the default;
        but some people may call the windows directory C:\Win95, C:\Win98
        or whatever...)
    
        Batch file contents
        ----------------------------------------------------------
         XXCOPY C:\        D:\         /h/r/y/ks/zy
         XXCOPY C:\Windows D:\Windows  /h/r/y/ks/zy/e/i/xtemp*\
        ----------------------------------------------------------
    
          Explanation:
    
            /i    // initializes (creates if absent) the new directory
            /x    // excludes (in this case, directories starting "temp")
    
        This batch file works even when the destination volume is
        not empty.  It handles only the root directory (the top layer
        only without including all the subdirectories) in the first
        statement.  The second one will handle the entire windows
        directory.  The /xtemp*\ switch excludes all directories whose
        name starts "temp" in \Windows.  This eliminates the official
        windows temporary directory (C:\windows\temp\) and the hidden
        internet-related temporary directory used by Internet Explorer
        (C"\windows\Temporary Internet Files\).  You may add more
        exclusion items.
    
        Caution:
    
          The /CLONE, /Z, and /ZY switch performs deletion of extra
          directories and files in the destination.  If you inadvertently
          specify a wrong destination, the consequence will be very
          severe.  Some careless users have lost many files by this!!!
    
        Note that this script does not give you the absolute minimum
        set of files in the destination for Win9x.  It will contain many
        files that are not essential to the minimum Win9x.  Also note
        that an international (non-US) version of Windows may require
        additional language-specific files.
    
    
    2.  Partial Disk cloning (bootable, even smaller):
    
        This is another variation of the second one with more strict
        selection of files (but not the absolute bare minimum).
    
        Batch file contents
        ----------------------------------------------------------------
         XXCOPY C:\                D:\                 /h/r/y/ks/zy
         XXCOPY C:\Windows         D:\Windows          /h/r/y/ks/zy/i
         XXCOPY C:\Windows\system  D:\Windows\system   /h/r/y/ks/zy/i
         XXCOPY C:\Windows\fonts   D:\Windows\fonts    /h/r/y/ks/zy/i
         XXCOPY C:\Windows\inf     D:\Windows\inf      /h/r/y/ks/zy/i
         XXCOPY C:\Windows\command D:\Windows\command  /h/r/y/ks/zy/i
        ----------------------------------------------------------------
    
        Note that this script does not give you the absolute minimum
        set of files in the destination for Win9x.  It will contain many
        files that are not essential to the minimum Win9x.  Also note
        that an international (non-US) version of Windows may require
        additional language-specific files.
    
    
    3.  Backup to multiple removable media (floppy, CD-R, zip drive, tape)
    
        A very common headache in backup today is that none of our
        removable storage device such as the CD-R and Zip drive gives
        us a sufficient capacity for a full backup in one volume.
        Since most device drivers do not provide a volume-spanning
        capability, we are left without a decent solution.  Here's
        one way to do it using XXCOPY.  This technique is nothing
        new.  It is as old as XCOPY and the Archive attribute bit.
        The basic principle is described in our earlier article, XXTB #06.
        Here, in the following example the A: (floppy disk) drive is
        used the destination --- but let's not kid ourselves...
    
        Batch file contents
        ----------------------------------------------------------------
         XXCOPY C:\                /aa/h/s/q
         :looptop
         @echo.
         @echo  Insert a blank media and hit a key to continue
         @echo.
         @pause
         XXCOPY C:\   A:\          /m/h/r/y/ks/zy/s/q
         goto looptop
        ----------------------------------------------------------------
    
          Explanation:
    
            /aa  // sets the archive attribute bit (no copy takes place)
            /q   // quiet (reduces screen output on superfluous info)
            /m   // copies files with archive bit and clears the bit
    
         The first statement simply sets the archive bit on every file in
         the source directory.  Then, the batch file enters an infinite loop
         (from which you can exit only by typing Ctrl-C or Ctrl-Break)
         where you are asked to insert a new diskette (or whatever),
         and exactly the same XXCOPY command copies a diskette-full chunk
         at a time.  The trick here is the good old /M switch which clears
         the archive bit of as soon as a file is successfully copied to
         the destination.  It's not really a fancy technique but it works.
    
         This technique is not limited to a full backup.  You may choose
         a subdirectory and apply the same method (add the /i switch then).
    
         In a real life backup situation, I strongly suggest that you
         learn and use XXCOPY's /X and /EX switches in order to avoid
         files that do not need a backup.  Otherwise, you will end up
         creating a massive amount of backup data where most of the files
         are available on your CD-ROMs somewhere.
    
         As Microsoft's programmers bloat the Windows software and force
         us to buy ever increasing amount of hard disk space, the
         percentage of user-generated data is declining in most computer
         systems.  Therefore, we need to be clever and more selective in
         setting up the backup script.
    
    
    If you have a nifty batch file using XXCOPY and want to share with
    other XXCOPY users, please let us know.  We may publish good ones.
    
    Please send E-Mail to <tech@xxcopy.com>.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #21


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY in a network environment
    Date:    2000-11-14
    ====================================================================
    
    While XXCOPY is useful in a stand-alone PC, it is widely used in
    network environments.  Since the default settings of various XXCOPY
    operations are designed primarily for copying local drives, you
    need to pay special attentions when you operate XXCOPY in a
    network environment.
    
    In this article, the following XXCOPY command switches are examined
    specifically with networked environments in mind.
    
       /NX0    Disables the shortname preservation feature
       /FT     Truncates the time value to be FAT-compatible
       /CK0    Disables pre-checking of the remaining space
       /FU     Selects universal time (UNC) for file time
    
    
    1.  The Shortname preservation.
    
          One of the reasons XXCOPY enjoys its popularity among freeware
          users is the shortname preservation feature.  While this
          feature is essential to ensure a proper duplication of the
          system drive, the feature may not work (and even becomes a
          detriment) in some networked environment with mixed Operating
          Systems (or file systems) where the source and the destination
          volumes are of different type in file system.  It is best if
          you test whether the shortname-preserving feature is working
          for you on your particular environment.
    
          Since shortname preservation feature requires XXCOPY to
          issue a sequence of system calls for renaming, it is a
          time consuming operation especially when it fails.  If your
          XXCOPY exhibits an inordinately low performance, you should
          suspect this feature as the likely cause of the trouble.
          In that case, just add  /NX0 to disable the feature (giving
          up the idea of preserving the shortname).  For example,
          it would be futile for XXCOPY to save the shortname while
          the underlying OS (e.g, Linux) does not even support it.
    
          XXCOPY sets the /NX switch on a local drive copy.  And, if
          either the source or the destination is specified by an UNC
          (starting with two backslashes.  E.g,  \\myserver\cdrive\),
          the /NX0 is used as the default setting.  If you assert your
          desire by an explicit /NX switch, the switch will be honored.
    
          Unfortunately, it is not always easy for XXCOPY to determine
          whether the combination of the source and the destination is
          suitable for the /NX operation, an explicit command switch
          of /NX and /NX0 should work the best.
    
           -----------------------------------------------------------
            Starting with v2.43.x, the shortname preservation feature
            is disabled by an UNC specifier either on src or dst.
    
            Due to Microsoft' XCOPY added their /N switch in recent
            Windows 9x release, XXCOPY's shortname preservation
            feature is no longer assigned to /N.  Starting with
            v2.42.0, it is controlled by /NX and /NX0.  We regret
            that this change forced us to broke existing batch files.
           -----------------------------------------------------------
    
          See article: XXTB #03, for related topics.
    
    
    2.  Time stamp granularity.
    
          Different file systems use different ways to keep track of
          the date and time information associated with a file.  When
          you use XXCOPY to transfer files from one file system to another,
          you should be aware of the characteristics of the file system.
          The granularity of the file time maintained by the OS is the
          first one to note:
    
                File System             File time granularity
               -----------------------------------------------
                FAT12/FAT16/FAT32            2 sec
                NTFS                       100 nsec
                Unix/Linux                   1 sec
    
          If your XXCOPY operation does not check the file time as the
          criteria for file selection, the granularity is not an issue.
          However, when you use an operation which involves the file time,
          you should know more.  The following list shows the switches
          which depend on the time stamp of the file.
    
              /BI     Backup Incremental
              /BN     Backup Newer files
              /Bo     Backup Older files
              /BS     Backup Same-time/size files
              /BX     Backup Different-time/size files
              /BU     Backup (combination using /BI)
              /DA     Copies Newer files
              /DB     Copies Older files
              /DS     Copies Same-time files
              /DX     Copies Different-time files
              /CLONE  Backup (combination using /BI)
    
          The best way to handle such a case with mixed file systems is
          to use the /FT (Filetime-Truncate) switch.  It converts all
          file time values into the FAT representation (2-second
          granularity) before a comparison is made.
    
    
    3.  Remaining space check.
    
          Ideally speaking, a file copy utility should know the remaining
          space on the destination before a copy operation is started.
          That is exactly what XXCOPY does.  However, when the destination
          directory is on a remote machine, the value XXCOPY receives as
          the remaining space from the Operating system is sometimes
          not accurate.  When this happens, XXCOPY terminates the current
          session and returns the "Disk Full" error condition.
    
          Many users have reported that XXCOPY prematurely terminates
          a session due to a false reading on the remaining space.  That
          is, XXCOPY's idealistic design backfires --- and the more
          primitive design (e.g., the COPY command) works better by not
          checking the remaining space.  So, you can override XXCOPY's
          pre-check feature by /CK0  (default is /CK).
    
    
    4.  Time stamp type, and locality .
    
          The original FAT12 and FAT16 file systems used by DOS had only
          one type of file time which represents the last-modified time.
          The FAT32 and NTFS maintain three types of time stamps for each
          file.
    
              Time when the file was Last-modified  (/FW  default)
              Time when the file was First-created  (/FC)
              Time when the file was Last-accessed  (/FA)
    
          By default, XXCOPY uses the Last-modified value as the file
          time (/FW).
    
          The file time is referenced either by the local time or by the
          universal time (UTC, also known as GMT).  The default setting
          uses the local time since most of us eat lunch at Noon(?).
          The setting is either /FL (Local, default) and /FU (UTC).
    
    
          Since we do not hear much problems associated with the
          time-representation aspects, we assume this is not a serious
          issue with XXCOPY.  But, XXCOPY is prepared to deal with it.
    
          See article: XXTB #15, for related topics.
    
    
    5.  Conclusion
    
          In this article, a few solutions are provided to alleviate
          common problems dealing with XXCOPY operation across networked
          drives.  The solutions listed here generally works.  However,
          they are only a guideline and your case may involve other
          factors which are overlooked in this article.
    
          For example, there is an inherent limitation to the accuracy
          of backup operation when you use the /FT switch to truncate
          the file time before comparison.  If you do not use the /FT
          switch, XXCOPY may select more than 50% of files for incremental
          backup while only a small fraction of them are really different.
          On the other hand, if you use /FT, a few unfortunate pairs
          of files whose time difference of 1 second is genuine would
          not be selected.  In a case like this, XXCOPY cannot help
          (nor any other utility).  It is a trade off.
    
          Please note that this article does not cover all common pitfalls.
          We welcome your feedback when you encounter similar problems
          which we have not yet addressed.
    
    
    Please send E-Mail to <tech@xxcopy.com>..
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #22


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: The leading backslash in a filespec
    Date:    2002-01-03 (revised)
    ====================================================================
    
    Introduction:
    
      As we see more and more IT professionals who are born after the
      WYSIWYG/GUI scheme was invented, certain key concepts which we
      took for granted are no longer a commonsense...
    
          xxcopy c:\  d:\  /clone
          xxcopy c:   d:   /clone
    
      If you know the difference of the two lines, just forget this.
      But, if you consider the two are about the same, this article
      is for you.  The difference is subtle and in many cases, the
      two lines are the same, indeed.  Howerver, in the second line,
      the context determines what will be copied and where will be
      the destination directory (and what will be deleted from the
      destination).
    
    
    Absolute pathspec and Relative pathspec.
    
      The first line of the above example explicitly specifies
      that both the source and the destination are the root
      directory of respective drives.  The second line does not
      specify which directory in the source and which directory
      of the destination within the respective drives.  That is,
      the second example above relies the exact location of both
      the source and the destination directories on the default
      behavior of the OS.  Microsoft's OSes keep track of the current
      (default) directory on each volume.  If it has not been
      defined yet, it will go to the root directory (which is what
      most users want).  Depending on the setting, when you open up
      a DOS box, the current (default) directory may or may not be
      at the root directory.  Also, the current directory of C: may
      be at c:\windows whereas on D:, it may be D:\.  You just
      cannot easily predict what it may be.  Therefore, the common
      assumption that an unspecified path is equivalent to the root
      directory is extremely dangerous with a tool like XXCOPY.
      The consequence of the /ZY switch (which is part of the
      /CLONE switch) on a wrong source or destination could be quite
      FATAL (wipes out all mismatched directories along with their
      entire contents).
    
    
    Actual examples:
    
      Let me give you one concrete example.  If you run the
      following command,
    
          cd  d:\mydir
    
      The current directory of Volume D: will be set to d:\mydir.
      So, unless you change the current (default) directory of
      Volume D: back to its root, when you say
    
          xxcopy c:\  d:        /clone
    
      Then, the line is equivalent to
    
          xxcopy c:\  d:\mydir  /clone
    
    
      Similarly, when volume C:'s current directory is not at the
      root directory (it could be at c:\windows) and you try to copy
    
          xxcopy c:  d:\          /clone
    
      In this case, it is equivalent to
    
          xxcopy c:\Windows  d:\  /clone
    
      Again, it would give you quite a surprise.
    
    
    More than one "current" directory:
    
      With the most popular setting of the DOS prompt which usually
      shows you the "current directory of the current drive" such as
      the following,
    
        C:\Windows> _
    
      You don't get any feedback on what is the setting of another
      drive.  For example, the same example shown above, the console
      (the DOS box window)
    
        C:\Windows> cd d:\mydir
        C:\Windows> _
    
      When the cd (chdir) command succeeds, there will be no confirming
      message.  The command is quietly accepted and executed.
    
    
    Why XXCOPY does not supply the leading backslash for you?
    
      Believe it or not, the way the Absolute pathspec and relative
      pathspec are handled throughout the command line environment,
      be it DOS, Win32, or even Unix, the convention for the absolute
      pathspec and the relative pathspec are so fundamental and
      ubiquitous, if we were to implement XXCOPY's own convention
      and let XXCOPY implicitly supply the missing leading backslash,
      it would create an unbelievable chaos.
    
      Therefore, XXCOPY cannot help you on this, except it prompts
      you with an additional warning prompt.
    
    
    Similar cases everywhere:
    
      The distinction of the absolute and relative path is not limited
      to the source and the destination pathspecs.  It applies to
      any filename you specify in the XXCOPY command line (and also
      for most other programs in Windows).  For example, we often
      hear users complaining about XXCOPY not creating the log file.
      You may have a habit of being casual about creating a log file,
    
          XXCOPY c:\src\  d:\dst\  /onmyerror.log
    
      and find no problem.  Yet, when you make a batch file using
      the same line, you may not find the log file as easily.  If you
      don't control the "current directory" of the batch file
      invocation, you may have a hard time locating the log file.
    
          --------------------------------------------------
           In Windows (for all the 9x and NT families),
           every shortcut object comes with a setting of
           the "current directory" (Right-click on the icon
           and look for the "Start in" setting).  In a case
           of a program file or a batch file, the directory
           specified in the "Start in" setting becomes the
           current directory when the program is executed.
          --------------------------------------------------
     
      My advice is to spell out the full filespec always:
      
          XXCOPY c:\src\  d:\dst\  /on"C:\My Document\myerror.log"
    
    
    Conclusion:
    
      So, if you are in a position to advise others on how to use
      XXCOPY with a concrete example, please do not abbreviate the
      leading backslash for cloning a directory.  This one-character
      difference could be just too great to ignore.
    
      Let me repeat,
    
      PLEASE NEVER USE A SLOPPY COMMAND LINE LIKE THIS
    
          xxcopy c:  d:   /clone     // BAD BAD BAD EXAMPLE!!!
    
      The /CLONE switch is too dangerous to let the system default
      setting determine the fate.  Instead always specify the
      directory using the full (absolute) directory path
    
          xxcopy c:\  d:\  /clone
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #23


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: The enhanced features of XXCOPY at a glance
    Date:    2000-12-06
    ====================================================================
    
    Here are some of XXCOPY's enhanced features over Microsoft's XCOPY.
    
    --------------------------------------------------------------------
    
     1. "Wild-Wild-source"
    
        XXCOPY c:\windows\*\*cache*\*\*.jpg  c:\myimages\
    
        Note the number and the positions of asterisks in the source.
    
    --------------------------------------------------------------------
    
     2. Exclusion switch (file template)
    
        XXCOPY c:\*\*cache*\*  \dst\   /X*.gif /X*.bmp
    
        /X allows you to exclude files that match the template.
    
    --------------------------------------------------------------------
    
     3. Exclusion switch (directory template)
    
        XXCOPY c:\  \dst\ /S  /Xtemp*\*\*.gif /X*\internet\*\*.mp3
    
        /X allows you to specify a group of directories and/or files
        that match quite a variety of directory/file patterns.
    
    --------------------------------------------------------------------
    
     4. Inclusion switch (file template only)
    
        XXCOPY c:\*.img   \dst  /S /IN*.bmp /IN*.gif /IN*.bmp
    
        /IN allows you to specify an "include" filespec (alternate
        filename pattern).
    
    --------------------------------------------------------------------
    
     5. Limit by file size
    
        XXCOPY c:\   d:\backup\  /S /SZ:-10000000
    
        This example copyies files whose size is 10MB or less.
    
    --------------------------------------------------------------------
    
     6. Select files by age
    
        XXCOPY c:\   d:\backup\  /S /DA#5
    
        This command copies files that were made within 5 days
    
    --------------------------------------------------------------------
    
     7. Select files by year/month/date
    
        XXCOPY c:\   d:\backup\  /S  /DA:2000-10
    
        This command copies files that were made in October, 2000 or later.
    
    --------------------------------------------------------------------
    
     8. Select the range of file date
    
        XXCOPY c:\   d:\backup\  /S  /DA:1999-1-1  /DB:1999-6-30
    
        The file range of Date betwen Jan 1 and Jun 30 of 1999.
        /DA (On-or-After) and /DB (On-or-Before) bracket the date range.
    
    --------------------------------------------------------------------
    
     9. Alternative to DELTREE
    
        XXCOPY "c:\My Documents\*\*.mp3" /RMDIR /DB:1999-12-31
    
        XXCOPY is not just for file copy.  The rich set of file selection
        switches can be applied to file deletion as well.
    
    --------------------------------------------------------------------
    
    10. Complex file search for a listing of custom output format.
    
        XXCOPY c:\windows\*\*cache*\*\my*\*\*.jpg  /LZDTL
    
        The /L switch offers a search and list capability with format control.
        This example lists Z(file size), D(ate), T(ime), and L(ongname).
    
    --------------------------------------------------------------------
    
    This list gives you only ten relatively straightforward switches to
    illustrate the power of XXCOPY.  The over 200 enhanced switches in
    XXCOPY can be combined for millions of combinations to fit your
    needs.  For a complete list of switches, see XXTB #01.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #24


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY's Macro processing feature
    Date:    2003-05-01  (revised)
    ====================================================================
    
    Introduction:
    
        When you create a batch file which performs a daily backup, you
        may want to name the destination directory after the current
        date and/or time.  Using the standard batch file this is rather
        difficult without a help of some fancy batch enhancer.
    
        For example, you may want to name today's backup destination
        directory using the current time
    
           XXCOPY C:\   D:\BACKUP\DEC-20\                   /S
           XXCOPY C:\   D:\BU001225\                        /S
           XXCOPY C:\   D:\BACKUP\2000-12-25\               /S
           XXCOPY C:\   D:\BACKUP\DAILY\FEB.04.2000.BUP\    /S
           XXCOPY C:\   D:\BACKUP\WEEK\BKUP_WED.BUP\        /S
    
        What is needed is to synthesize certain names based on the current
        system time.
    
    
    The XXCOPY macro processing feature.
    
        XXCOPY provides a set of predefined variables which can be entered
        in your command line (or the current value in the string of environment
        variable, XXCOPY).  The technique used here is sometimes called
        "Macro processing" albeit this is a very small implementation which
        allows you to reference (you cannot add new macro definitions) a
        predefined value through a simple rule of substitution.
    
        Macro reference may be used anywhere in your command line (or the
        XXCOPY environment variable (XXCOPY and XXCOPYX), or even in the
        exclusion item parameters.  That is, anywhere you normally supply
        a string of characters, you can place a macro reference.
    
        The trouble is, people's tastes are so different, providing just
        one way would always make someone unhappy.  Take the date for
        example, despite our crusade in advocating the ISO 8601 standard
        (yyyy-mm-dd), few would listen.  So, XXCOPY provides just a few
        building blocks and lets you combine them whichever way you want.
    
    
    The macro reference examples
    
        Before showing the gory details, let me show you examples which give
        you a good start.  Just observe what is going on.  You will get a
        pretty good idea how XXCOPY processes the macros.
    
        Let's assume it is  Friday, July 4, 2003 01:05:30 pm.
    
        /$DATE$        --->  0704          // common 4-digit month/day
        /$TIME$        --->  1305          // common 4-digit hour/minute
        /$YYYY-MM-DD$  --->  2003-07-04    // hyphens may be added
        /$M-D-YY$      --->  7-4-03        // no leading zeros for mn dy
        /$DD.MM.YY$    --->  04.07.03      // Europeans may like this
        /$MON-DD$      --->  JUL-04        // 3-letter month may be used
        /$WWW$         --->  FRI           // 3-letter day of week
        /$IIII-IWK-K$  --->  2003-W17-5    // ISO-8601, Year, week no, day-of-week
    
    
    What is a valid macro reference?
    
        /$xxxxxx$
    
        XXCOPY's macro reference always starts with a slash (/) which is
        immediately followed by a macro reference string which starts with
        a dollar sign ($) followed by zero or more macro keywords and ends
        by a dollar sign.
    
        Within the two dollar signs of a macro reference (xxxxxx shown above),
        zero or more of predefined macro keywords may be specified (multiple
        keywords are combined without any separating character).
    
        The following keywords are currently supported (we may add more
        later).
    
          Keyword     Value       comment
         -----------------------------------------------------------
          HOST        MYWINPC     up to 15 character machine name
          YYYY        2003        4-digit year (good for 10000 years)
          YY          03          2-digit year (good for a century)
          Y           3           1-digit year (good for a decade)
          MON         DEC         3-letter month name
          MM          07          2-digit month
          M           7           1 or 2 digit month (without leading 0)
          DD          04          2-digit day
          D           4           1 or 2 digit day (without leading 0)
          HH          13          2-digit hour (00-23)
          H           13          1 or 2 digit hour (0-23) (without leading 0)
          NN          05          2-digit minute
          N           5           1 or 2 digit minute  (without leading 0)
          SS          30          2-digit second
          S           30          1 or 2 digit second  (without leading 0)
          DATE        0704        same as MMDD
          TIME        1305        same as HHNN
          WWW         FRI         3-letter day of week name
          W           5           1-digit day of week (Sun:0 - Sat:6)
          IIII        2003        4-digit year (ISO week number notation)
          II          03          2-digit year (ISO, 2-digit-year value)
          IWK         W17         2-digit week number (always prefixed by W)
          K           5           1-digit day of week (ISO, Mon:1 - Sun:7)
    
    
    Single-key macro reference
    
        The simplest macro reference is made of one keyword inside.
    
          /$DATE$    --->   0704
    
        You may combine as many single-key macros
    
          /$YYYY$/$MM$/$DD$   --->    20030704
    
    
    Multiple-key macro reference
    
        You may chain two or more keywords within a macro reference
        without any other character.  A macro reference is parsed
        from left to right and the longest string which matches the
        pattern will be used first.
    
          /$YYYYMMDD$  --->   20030704     // same as /$YYYY$/$MM$/$DD$
          /$YDATE$     --->   30704
    
        For readability and punctuation, the following characters are
        also supported.
    
           T ! # % & ' ( ) , - . @ _ { } ~ `
    
        These characters function as a keyword and represent the character
        literally (after expansion, they appear as typed in the reference).
    
          /$YYYY-MM-DD$  --->   2003-07-04
    
    
    Miscellaneous rules.
    
        1.  You may use a keyword within a macro reference more than once.
            (In nearly all cases, this makes little sense, but it's allowed).
    
             /$YYYYYYYY$  --->   20032003  ( YYYY  and YYYY )
             /$YYYYYYY$   --->   2003033   ( YYYY and YY and Y )
             /$WWWW$      --->   FRI5      ( WWW and W )
    
        2.  Macro reference is case-insensitive
    
             /$DATE$      --->   0704
             /$date$      --->   0704
             /$DaTe$      --->   0704
    
        3.  Macro reference is case-preserving
    
             /$MON$       --->   JUL
             /$mon$       --->   jul
             /$Www$       --->   Fri
             /$wWw$       --->   fRi
    
             Note:  Of course, this feature is good only for XXCOPY.
                    Since XXCOPY16 is governed by the DOS rule, all
                    filenames will be converted to uppercase only.
    
        4.  A dollar sign ($) cannot be inside a macro reference.
            If you need a dollar sign, you should do it outside.
    
             /$MM$$/$DD$  --->   07$04    // a macro, $, and another macro
    
        5.  Year, followed by week-number should be denoted by
        
             /$IIII-IWK$  --->   2003-W27 // See below for details
    
    
    Where can a macro reference be placed?
    
        You may use a macro reference string ( /$xxxx$ )  anywhere in your
        command line as well as in the environment variables, XXCOPY and
        XXCOPYX (yes, even inside an exclusion specifier).  That means, you
        may place it in the external exclusion list file (specified by
        the /EX switch).  It is also permitted in alternate filename template
        (/IN) specifiers.  In short, practically anywhere you enter a string
        of text, XXCOPY will accept a macro reference and expand it
        accordingly.
    
    
    Recommendation of macro usage.
    
        For DOS-compatibility, you should keep the directory names to
        the 8.3 format.  It will be much easier to access directories
        from a real mode (DOS) environment.
    
        For routine backup, a five- or six-digit date code is probably
        a good choice for most occasions.
    
         d:\bu\bu/$yymmdd$.c\    --->   d:\bu\bu030704.c\
         d:\bu\b/$ymmdd$_c\      --->   d:\bu\b30704_c\
         d:\bu\bu_/$MONYY$\c\    --->   d:\bu\bu_JUL03\c\
    
        Using two-digit year value as opposed to one-digit year value
        is all up to you.  In general, just 1-digit year format gives
        you values that are unique for ten years.  That's quite adequate
        for most backup operations.  In this context, using a four-digit
        year value (/$YYYY/) in the directory name is overkill especially
        if the directory name exceeds the 8.3 format.
    
    
    The ISO 8601 standard.
    
        We take a very strong position in endorsing the ISO 8601 standard
        which provides logical and convenient guidelines in describing
        date and time values.  Visit http://www.iso.ch.
    
        The most prominent aspect of the ISO 8601 standard is of course,
        its date order in the YYYY-MM-DD format and the 24-hour notation,
        hh:nn:ss.  XXCOPY also supports ISO's lesser-known week date
        representation.
        
        According to the ISO definition, the week begins on Monday and
        ends on Sunday.  XXCOPY denotes the ISO's day-of-the-week
        value using /$K$.  The only difference between ISO's day-of-the-
        week value (/$K$) and the traditional day-of-the-week radix (/$W$)
        counterpart is the value for Sunday (/$K$ = 7 and /$W$ = 0);
        other days (Monday through Saturday) will have the same values.
    
        ISO 8601 also defines the "Week date" which assigns a number to
        each week of the year (More examples can be found here).
        Unfortunately, when the first day of the year does not coincide
        with the beginning of the week (Monday in ISO's specification),
        the week will straddle over two years for which special rules
        are made.  A week belongs to the year which is more dominant
        (has four or more days in the week).  So, the first week of
        the year (W01) is defined as the week which contains the 4th day
        of January.  With this rule, up to three days at the beginning
        of the year and also up to three days at the end of the year
        the date may become a part of the previous calendar year or the
        next calendar year, respectively.  This may be a bit confusing,
        but that's the rule and we understand why it is necessary.
        
        The Week-of-the-year value is always described with the prefix, W
        followed by a two-digit decimal value (starting 01) which is
        referenced by the /$IWK$ keyword.
    
        E.g.   Fri, 2003-07-04  --->  2003-W27-5
               Sun, 2003-12-28  --->  2003-W52-7
               Mon, 2003-12-29  --->  2004-W01-1  == next year value
               Thu, 2004-01-01  --->  2004-W01-4
               Sat, 2005-01-01  --->  2004-W53-6  == prev year value
    
        For this irregularity in the year values, XXCOPY assignes the
        /$IIII$ (and /$II$ for the two-digit notation) to be used in
        the week-of-the-year context to differentiate it from the
        calendar year value (/$YYYY$ and /$YY$, respectively).
    
    
    Q and A:
    
       Q:  Why T is in the list of punctuation characters?
    
       A:  T is a special punctuation character as an exception since
           our favorite standard, the ISO 8601 stipulates the use of T
           to connect the date part and the time part.
    
             /$YYYY-MM-DDTHH.NN.SS$ ---> 2003-07-04T13.05.30
    
           (Alas, the colon (:) character is not a legal character
            for a filename and the dots are used instead.)
    
           You may use @ as an alternative separator:
           
             /$YYYY-MM-DD@HH.NN.SS$ ---> 2003-07-04@13.05.30
    
       Q:  Is there any way to test exactly how my macro usage is working?
    
       A:  If you are not sure of the effect of a macro, add the
           /EC (echo) switch that displays the full command line
           after the macro references are expanded.
    
           Example:
    
              XXCOPY  \src  \dst\/$DATE$\/$YYMMDD$\  /EC /W
    
              Here, the /EC gives you the line after the macro expansion,
              and /W will pause and let you terminate the command if you
              don't like the effect of the macro.
    
    
       Q:  Why the slash (/) is used in the macro prefix?
    
       A:  We wish we have more characters in the keyboard.  Seriously,
           the design goal of the XXCOPY Macro feature was to allow you
           to use it in as many places as possible (within the source and
           destination specifiers, as well as in other switch parameters).
           Since the macro reference should be anywhere (including a
           partial word), the macro syntax has to use a terminator (hence,
           the $xxxx$ sandwich).  Because the dollar sign ($) is a valid
           character for filename, we need a prefix character which is
           not permitted in filename.  Actually, there are only nine
           such characters in English alphabet ( " * ? : < > | \ / ) that
           are not permitted in Windows' filename.
    
           Every one of these character has some form of conflict with
           other usages.
    
             "  *  ?  \ are out of the question.
             <  >  |  are reserved by the command shell (COMMAND.COM).
    
             :  used only at the drive letter designator.
             /  used as the prefix for the command switch.
    
           So the choice was between the two (: and /).  We chose the
           two-character sequence, "/$" of the macro reference as a
           distinguishing feature from other switches.  Fortunately,
           XXCOPY's command syntax stipulates that the source and destination
           specifiers to be always separated from other switch arguments by
           a space, therefore, a macro reference embedded inside source or
           destination specifier can unambiguously parsed.  It's not pretty.
           It took us several months to settle on this syntax.  Now the
           journey is over.  Enjoy the macro.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #25


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY Command Line Syntax
    Date:    2002-05-07 (revised)
    ====================================================================
    
    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 that starts with a
      slash (see below).
    
    
    The Command Line Delimiter:
    
      XXCOPY   source  [ destination ]  [ switches... ]
    
      These up to three (or more) parts must be separated by at least one
      blank (usually the space character but a tab may be used).  The role
      of the blank character as a separator (which is called "delimiter")
      in the command line is very important.  XXCOPY relies on the
      separating blank characters to know where the end of the source
      specifier and where is the beginning of the destination specifier.
      For this reason, if you have a source specifier (such as "My Documents")
      which has a space inside, you must enclose the whole source specifier
      by double quotes.
    
         Example:
    
           XXCOPY  "C:\My Documents\"
    
      If you omit the double quotes, like the following line,
    
           XXCOPY  C:\My Documents
    
      XXCOPY would interpret "C:\My" as the source specifier and "Documents"
      as the destination (If you have another item which you really meant
      as your destination, it would be ignored as a third and useless item).
      It does not hurt to surround the source (or destination) specifier by
      double quotes.
    
    
    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 following command line is equivalent to the one
      shown above.
      
          XXCOPY /S  C:\mydir\  /H  D:\yourdir\
      
      The order of the switches is not generally important except when
      a 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.
    
      Once you learn this simple rule, it is quite easy to understand a
      long XXCOPY command line.
    
    
    XXCOPY switches:
    
      A command switch (we call it just switch most often) is any command
      paremeter that is neither the source specifier (referred to as
      "source" above) nor the destination specifier (referred to as
      "destination" above).  A switch instructs XXCOPY the details of
      the operation which deviates the default behavior.  As a matter of
      fact, without the switches, XXCOPY is only as boring as the standard
      COPY command.
    
      For example,
    
          XXCOPY c:\mydir\  d:\yourdir\
    
      This line copies the files from one directory to another.  Since
      the default behavior is not to include hidden or system files, and
      not to include subdirectories, this operation will copy just a handful
      of regular files.  If the destination already has some of the files
      you will be greeted by a prompt asking whether you want to overwrite
      the file or not.  Moreover, if the existing file has the read-only
      attribute (i.e., write-protected), you are out of luck.
    
      The rich set of command switches set XXCOPY apart from other file
      management tools.  Being a command line program, XXCOPY is not
      easy to use.  You have no choice but to become familiar with the
      very large collection of switches (over 175 switches and growing),
      if you want to harness the power of XXCOPY.  The good news is that
      you need not learn all.
    
      Syntactically, all of XXCOPY's command switches starts with a slash
      ( /  some people call it forward-slash).  To keep the command line
      somewhat more manageable, XXCOPY allows you to connect one command
      switch with the next without any delimiting character (typically
      a space).  With just one exception (XXTB #24), an item that starts
      with a slash is a command switch.
    
      For more discussion of XXCOPY command switches and the detailed
      discussion of the source specifier, see the following
    
          for Command Parameter Reference                  XXTB #01
          for Command Reference Alphabetic Listing         XXTB #26
          for Command Reference Functional Classification  XXTB #27
          for The Wild-Wild-Source Specifier               XXTB #28
    
     = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    
    
    Source Specifier (XCOPY-compatible standard):
    
      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 Microsoft's XCOPY (and also for
      our XXCOPY), the source specifier may contain the directory and
      an optional file pattern specification whose subtleties are not
      fully appreciated by many XXCOPY users.
    
      The XCOPY-compatible source specifier has three parts:
    
         [ volume_spec ] [ directory ] [ file_pattern ]
    
    
      Example (the destination specifier is omitted here):
    
         XXCOPY    c:\mydir\*.doc
         XXCOPY    \\myserver\drivec\config.sys
    
    
      Here, the three parts in the XCOPY-compatible source specifier
      are quite obvious.  The second example is with the UNC which is
      how you specify a remote drive (via a network).
    
        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.
    
        directory
    
          The name of the source directory.  When the XXCOPY command
          contains the subdirectory switch (/S and/or /E), the directory
          specifier denotes the starting directory where the source
          files and subdirectories are located.  The XCOPY-comatible
          directory part does not contain a wildcard character.  The
          more advanced "Wild-wild-source" feature in XXCOPY accepts
          wildcards.  For example,
    
              XXCOPY  C:\Windows\*\?cache*\*\*.jpg  \dst\
    
          A separate article, XXTB #28 gives you the full detail.
    
        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.
    
    
    Destination Specifier:
    
      Just to make the discussion of XXCOPY's command parameter syntax
      complete, let us go over the subject of the remajing item, the
      destination specifier.  Fortunately the rules for this are not
      complicated.  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.
    
    
    The Base Directory:
    
      When a directory (and the subdirectories) is copied from the
      source to the destination, the first level of the source directory
      will correspond to the first level of the destination directory
      that is specified as the destination.  We call the first level in
      the source directory the "Base Directory".  Since the destination's
      first level directory is named by the destination specifier that
      you provide in the command line, the directory name in the destination
      is not always the same.
    
      For example, when you run the following command,
    
         XXCOPY  c:\mypath\mysrcdir\   d:\your\dstdir\  /S
    
      Any part of the Base Directory is not necessarily become a part
      of the destination directory.  This is true even the last name
      (mysrcdir) does not automatically appear in the destination side.
      The end result will be like this.
    
         c:\mypath\mysrcdir\file1.doc   --> d:\your\dstdir\file1.doc
         c:\mypath\mysrcdir\sub1\a.doc  --> d:\your\dstdir\sub1\a.doc
    
      Here, the Base Directory is c:\mypath\mysrcdir\.  The concept of
      the Base Directory is even more important in the treatment of the
      exclusion parameter.  When an exclusion item is given as a relative
      path, the directory path specified is relative to the Base Directory.
    
      For example, with the same directory
    
         XXCOPY  c:\mypath\mysrcdir\   d:\your\dstdir\  /S /Xtemp*\
    
      The exclusion switch's parameter (temp*\) is understood to be
      relative to the Base Directory which is in this case:
    
         c:\mypath\mysrcdir\temp*\
    
      Of course, you may always use an absolute path for the /X parameter:
    
         XXCOPY c:\mypath\mysrcdir\ \dst\ /S /Xc:\mypath\mysrcdir\temp*\
    
      A more rigorous definition of Base Directory will be given in the
      discussion of the source directory which contain wildcards
      (Wild-Wild-Source)  XXTB #28.
    
    
    

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

    XXCOPY TECHNICAL BULLETIN #26


    
    From:    Kan Yabumoto           tech@xxcopy.com
    To:      XXCOPY user
    Subject: XXCOPY Command Reference Alphabetic Listing
    Date:    2007-03-10  Revised for ver 2.95.1
    ====================================================================
    
    This article lists XXCOPY's command switches in alphabetic order.
    For a functional classification of the command switch, see XXTB #27.
    
    
             /?  Shows a summary of the switches on one page.
         ... /?  Shows related switches when entered with other switches.
    
             /0  Disables DATMAN One-pass copy (not recommended, but allowed).
             /1  DATMAN One-pass copy (when copying from DATMAN tape, default).
    
             /A  Same as /ATA. Copies files with the archive attribute set.
                 Doesn't change the attribute.
    
            /A0  Ignores the archive attribute bit and does not change it.
    
            /AA  Sets the src file archive bit (without actually copying).
    
            /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).
    
     /ARD<mask>  Resets directory attribute bits (clears specified bits).
    
      /AS<mask>  Sets file attribute bits (sets specified bits).
    
     /ASD<mask>  Sets directory 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 and /ASD work on directories analogous to /AR and /RS.
    
    
      /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).
    
            /AZ  Clears the src file archive bit (without actually copying).
    
          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.).
    
            /B0  Undo any of /BI, /BB, /BN, /Bo, /BX, or /BZ switches.
    
            /BB  Backs up brand new files only (does not overwrite existing ones).
    
            /BE  Backs up exactly the same files(includes brand new files).
    
            /BI  Backs up incrementally, different (by time/size) files only.
    
            /BN  Backs up newer files only      (includes brand new files).
    
            /Bo  Backs up older files only      (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).
    
            /BX  Backs up different-date files  (includes brand new files).
    
            /BZ  Same as /BZX.
    
           /BZE  Backs up equal-size  files  (includes brand new files).
    
           /BZS  Backs up smaller-size files (includes brand new files).
    
           /BZL  Backs up larger-size files  (includes brand new files).
    
           /BZX  Backs up different-size files  (includes brand new files).
    
        /BACKUP  Standard Backup without deleting any file (/CLONE without /ZY).
                 A shortcut for the following combination: /KS/H/E/R/Q/Y/BI/ZE/oD0.
    
             /C  Continues copying even if errors occur (default).
    
            /C0  Disables the /C switch (terminates upon error).
    
            /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
    
            /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.
    
            /CC  Warns a cyclic copy with a Y/N prompt.
    
           /CC0  Disallows cyclic copy (src includes the dst directory) (default).
    
           /CCY  Allows a cyclic copy by excluding the destination from the src.
    
            /CE  Same as /CBQ/EC (most useful in batch file with @echo off).
    
     /CF<fname>  Specifies a Command File which provides text as if it were typed
                 at the position where the switch appeared in the command line.
                 The Command File is a text file which may have multple lines.
    
            /CK  Checks remaining space before copy (default).
    
           /CK0  Disables the pre-check of remaining space before copy.
    
          /COPY  Selects the file copy action (default).
    
         /CLONE  Duplicates a directory (volume).  This switch is a shortcut for
                 the following combination: /KS/H/E/R/Q/Y/BI/ZY/ZE/oD0.
    
         /CR<n>  Sets the retry period (n seconds, default = 3) on failed copy.
    
             /D  Same as /DA.
    
            /D0  Cancels all file-date related (/D...) switches.
    
      /D:<date>  Same as /DA:<date>.
    
            /DA  Copies newer files and brand new files.
    
        /DA#<n>  Copies files that were changed on or after  <n> days ago.
    
          /DA:.  Copies files that were changed today or later (same as /DA#0).
    
     /DA:<date>  Copies files that were changed on or after the specified date.
    
            /DB  Copies older files and brand new files.
    
        /DB#<n>  Copies files that were changed on or before <n> days ago.
    
          /DB:.  Copies files that were changed yesterday or earlier.
    
     /DB:<date>  Copies files that were changed on or before the specified date.
    
     /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).
    
        /Do#<n>  Copies files that were changed on the day   <n> days ago.
    
          /Do:.  Copies files that were changed today only.
    
     /Do:<date>  Copies files that were changed on the specified date.
    
          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.
    
            /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).
    
                 /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 two
                 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.
    
          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 /DB and /DD, if date is omitted, are the same as /BN and /Bo
                 except they can be combined with another /B switch (e.g., /BI).
    
          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.
    
         /DEBUG  Shows the command parameters and prompts you to start.
    
        /DEBUGX  Shows the command parameters and exits.
    
         /DL<n>  Limits processing of directory nesting to n levels.
                 /DL0 removes the limit.  /DL works only when /S or /E is set.
    
             /E  Copies directories and subdirectories, including empty ones.
                 Same as /S /E.
    
            /EC  Echoes the entire command line (after macro processing).
    
            /ED  Preserves the directory even if it becomes empty.
    
           /ED0  Deletes empty directories (default).
    
         /ED<n>  Preserves n levels of empty directories.
    
          Note:  The /EDxx switches are in effect only with file/directory removal
                 operations (/Z, /RC, /RS, /RD, /RX, and /CLONE cases).
    
            /ER  Emulates XCOPY's exit code (for ERRORLEVEL check in batch files).
    
     /EX<xlist>  Specifies a text file which contains a list of xspecs (see below).
    
             /F  Displays full source and destination file names while copying.
    
     /Fo<fname>  Displays full source and file names and also saves into a file.
    
            /FA  Uses the Last-Access timestamp for Filetime comparison.
    
            /FC  Uses the Creation timestamp for Filetime comparison.
    
            /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.
    
           /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.
    
    
            /FR  Legacy switch; replaced by /FF-2.
    
            /FT  Legacy switch; replaced by /FF+2.
    
            /FL  Filetime in Local time (default)
    
            /FU  Filetime in UTC (Universal Coordinated Time - same as GMT).
    
            /FW  Uses the Last-Write timestamp for Filetime comparison (default).
                 Note: /FW, /FA and /FC are mutually exclusive choices.
                 Note: /FL and /FU are mutually exclusive choices.
    
          /G<n>  Sets DATMAN N-Group (redundant) write. (<n> : 0 - 7).
                 e.g., /G1 writes the same data twice on DATMAN tape.
    
             /H  Copies hidden and/or system files also.
    
            /H0  Excludes hidden and/or system files (default).
    
            /Ho  Copies hidden and/or system files only.
    
          /HELP  Shows the switches in detailed (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.
    
         /HOSTS  Displays the names of remote hosts accessed by XXCOPY.
    
             /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.
    
      /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).
    
       /INSTALL  Installs the XXCOPY software package on your computer.
    
       /INSTALL:<dir>   Installs XXCOPY in a user-specified directory.
    
             /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.
    
             /K  Keeps the source attributes including read-only (same as /KS).
    
            /K0  Keeps H-bit and S-bit, sets A-bit, clears R-bit (default).
    
            /KD  Keeps the attributes of destination (overwritten) file.
    
            /KN  Sets the destination attributes to normal (only /A).
    
            /KS  Keeps the source attributes including the read-only bit.
    
             /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
                    N   long name without path
                    R   relative path
                    P   parent path
    
                 Note: When S, L, N, and R are all missing, L is used by default.
    
       /LICENSE  Displays the XXCOPY license status on your computer.
    
         /LTREE  Lists directory tree (without copy or making directories).
                 Note: with /LTREE, the /DA/DB/DO parameters apply to dir time.
    
             /M  Copies only files with the archive attribute set.
                 Turns off the archive attribute.
    
       /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).
    
             /N  Uses the short (8.3) name for name matching, and creation.
    
            /NP  Uses precise name matching (ignores match in alias).
    
            /N0  Disables /N and /NP (default, uses longname when applicable).
    
           /NC0  Disables /NCL, /NCU, or /NCX (accepts letters of both cases).
    
           /NCL  Uses Lowercase-only name when a new file is created.
    
           /NCU  Uses Uppercase-only name when a new file is created.
    
           /NCX  Uses Uppercase-only name when a new short-name file is created.
    
            /ND  Uses the old (DOS) Wildcard treatments for filename matching.
    
            /NW  Uses the new (Win32) Wildcard treatments for filename matching.
    
            /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).
    
            /NL  Renames longname to match the source (No copy operations).
    
            /NS  Renames shortname to match the source (No copy operations).
    
            /NX  Preserves the shortname when the file is copied.
    
           /NX0  Disables the /NX (shortname preservation) feature.
    
                 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.
    
            /o0  Cancels the /oN or /oA switch specified earlier.
    
     /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
    
         /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).
    
         /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 sufix value <n> for /oD /oE /oF /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.    
    
    
    
             /P  Prompts you before creating each destination file.
    
            /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.
    
    
            /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).
    
           /PD0  Suppresses the prompt before a destructive processing of directory.
    
            /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).
    
           /PZ0  Suppresses prompts for directory confirmation on /CLONE /Z /ZY.
    
             /Q  Same as /Q1.  Does not display files which are skipped.
    
            /Q0  Displays all filenames.
    
            /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.
    
            /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.
    
             /R  Allows overwrite/delete of read-only files.
    
            /R0  Cancels overwrite/delete of read-only files.
    
            /RC  Removes files in src after a successful copy (equivalent to move).
    
           /RCP  Prompts on source-file-remove after successful copy (default).
    
           /RCY  Suppresses prompts after a successful source-file-remove.
    
            /RD  Removes files in dst which qualify to be overwritten (no copying).
    
         /RMDIR  Removes a directory.  Same as /RS/S/H/R/PD0/ED0.
    
            /RS  Removes files in src which qualify (no copying).
    
            /RX  Removes files in dst which are absent in src (no copying).
    
          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.
    
             /S  Copies directories and subdirectories except empty ones.
    
            /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.
    
            /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).
    
            /SR  Flattens subdirectories, add-name-Right  (see below).
    
            /SX  Flattens subdirectories, add-name-Middle (see below).
    
           /SLR  Rebuilds flatten