DATMAN Home Page

XXCOPY
XXCOPY
XCOPY
COPY
OPY
PY
Y


Simply, a Logical Extension


XXCOPY Version 2.25.1 2000-05-07

What's so unique about XXCOPY?

What's ordinary about XXCOPY?

Freeware Download The latest release (this page revised on 2000-05-07) XXCOPY Version 2.25.1 2000-05-07 XXCOPY16 Version 1.22.2 1999-11-30 Highlight of this beta test version: The new Remove (/RC,/RS,/RD,/RX) switches which allow you to delete a group of files using XXCOPY's powerful file qualifier mechanism. See details in the reference page (
XXTB #012). The common directory clone operation made easy by the /CLONE switch.
Ready to download? Click here --> Start Download (XCPY2251.ZIP) via FTP

If you have problem with FTP, try this --> Alternate Download via HTTP


XXCOPY Technical Bulletins (Reference)



Pixelab

Pixelab, Inc.
1212 S. Naper Blvd., Suite 119
Naperville, Illinois 60540 U.S.A.

Founded in 1986


Phone    = +1-630-369-7112
Fax      = +1-630-369-7113
E-Mail   = <sales@datman.com>

Web Home = http://www.datman.com/

Pixelab is better known as the publisher of the revolutionary tape control software,DATMAN. The predecessors of XXCOPY were developed as a utility for DATMAN users. Now, XXCOPY was brought to you as a stand-alone package by popular demand.
DATMAN Home Page

Updated 2000-05-07 (http://www.datman.com/xxcopy/)
© Copyright 2000 Pixelab, Inc. All rights reserved.

















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #01



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: XXCOPY Command Parameters Reference
Date:    2000-02-16
====================================================================

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 is also called
  options) to customize XXCOPY's behaviors.  It is this extensive
  set of switches that makes XXCOPY so versatile and powerful.


Full Command Parameter Syntax:

  XXCOPY   source  [ destination ]  [ switches... ]

  Note that the positions of 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
  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.

  To distinguish the source and destination parameters, 
  All switches start with a slash (/) character and the source and
  destination specifiers must be separated at least one blank (space)
  character.  So, it is easy to tell the source and destination
  specifier (which are the most important parameters for XXCOPY).
  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.
  

  -----  The following switches use the archive attribute bit -----

         /A  Copies files with the archive attribute set.
             Doesn't change the attribute.
         /M  Copies files with the archive attribute set.
             Turns off the archive attribute.
        /AC  Copies specified files irrespective of the archive attribute.
             Turns off the archive attribute after XXCOPY.
        /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).
        /A0  Ignores the archive attribute bit and does not change it.
            (The archive bit is discussed in XXTB #06)

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

         /H  Copies hidden and/or system files also.
        /Ho  Copies hidden and/or system files only.
         /R  Overwrites read-only files.
        /K0  Keeps the source attributes except rdonly (default)
         /K  Keeps the source attributes including rdonly (same as /KS).
        /KS  Keeps the src attributes whose RDONLY bit is normally reset.
        /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 do NOT use the archive attribute bit -----

        /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).
        /BS  Selects exactly the same files (this is useful with /RS).
        /BU  Standard Backup switch (same as /r/i/n/bi/q/c/h/e/v/y)
        /B0  Undo all /Bx switches.
         /U  Updates the files that already exist in destination.

  -----  The following switches excludes a directory or files -----

   /X<xspec> Adds an exclusion specifier (xspec) (see below for exclusion).
  /EX<xlist> Specifies a text file which contains a list of xspec (see below).
             Exclusion specifier (xspec) syntax (consists of up to 3 parts):
             [ dir_spec ] [ *\ ] [ template ]
               dir_spec   Always ends with 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.
               template   Must not contain backslash (\), but may contain
                          wildcard characters(s) (* and/or ?).
             Any of the three parts can be omitted.
             If dir_spec is omitted, the template applies to all directories

             See XXTB #05  (The Exclusion specifier).
  -----  The following switches limit files by file dates -----

         /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.
   /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.
      /DA:.  Copies files that were changed today or later.
      /DB:.  Copies files that were changed yesterday or earlier.
      /Do:.  Copies files that were changed today only.
             /DA:<date> and /DB:<date> work as a pair if both are specified.
             e.g., /DA:2000-01-01 /DB:2000-12-31  files made in 2000
                   /DA:2000-04-01 /DB:2000-04-30  files made in April 2000.
                   /DB:2000-03-31 /DA:2000-05-01  exclude files made in April
                   /DA:2000-01-02 /DB:2000-01-02  try shorter /DO:2000-01-02
             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 are with
             2-digits, it is interpreted according to the system setting.

      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.
        /D0  Cancels all file-date related (/D...) switches.

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

        /FW  Filetime in Last-Write time (default)
        /FA  Filetime in Last-Access time
        /FC  Filetime in Creation time
             Note: /FW, /FA and /FC are mutually exclusive choices.
        /FL  Filetime in Local time (default)
        /FU  Filetime in UTC(Universal Time Coordination - same as GMT)
             Note: /FL and /FU are mutually exclusive choices.

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

         /S  Copies directories and subdirectories except empty ones.
        /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.
      /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 (`).
         /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).
         /I  If destination does not exist and copying more than one file,
             assumes that destination must be a directory (no prompting).
         /Z  Deletes extra files or subdirectories in destination.
        /ZY  Same as /Z without prompting.
        /ZX  Disables the use of the Environment Variable XXCOPYX

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

         /P  Prompts you before creating each destination file.
        /PD  Prompts you before starting each directory with options for...
             Y (Yes), N (No), A (All), R (Remaining dirs), S (This & subdirs)
         /W  Prompts you to press a key at the start of copying.
        /WS  Same as /W.
        /WE  Prompts you to press a key at the end of copying.
        /WD  Prompts with a warning for copying a non-directory src (default).
       /WD0  Suppresses warning for copying a non-directory source.
         /C  Continues copying even if errors occur (default).
        /C0  Disables the /C switch (terminates upon error).
         /Y  Overwrites existing files without prompting (See /BB).
        /-Y  Prompts you before overwriting existing files.
        /Y0  Same as above (/-Y).

  -----  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 succcessful 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 supress respective prompt.
             For these remove-without-copy switches, the /Y and /-Y switche
             also controls the prompt for the remove action.

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

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

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

         /N  Keeps the short filename consistent with the source (default)
        /N0  Disables the /N feature (disables short/long name pairing)
        /NL  Renames long name to match the source (No copy operations)
        /NS  Renames short name to match the source (No copy operations)
     /SZ<n>  Size limit (only the first n bytes are copied).
         /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)
 /VX<fname>  Exclude verify error output for the file specified.
         /L  Displays files that WOULD be copied (without actually copying).
         /F  Displays full source and destination file names while copying.
 /FO<fname>  Displays full source and file names and also saves into a file.
      -----  The following switches control the console output -----
         /Q  Does not display file names while copying.
        /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.
 /ON<fname>  Outputs a new logfile, reporting errors (make a new log) file.
 /OA<fname>  Appends to a logfile, reporting errors. (does not overwrite log). 
        /O0  Cancels the /ON or /OA switch specified earlier
        /OP  Reports command switch parameters (also to logfile if enabled)
        /OX  Reports the exclusion parameters (also to the logfile if enabled)
     /DEBUG  Shows the command parameters and prompts you to start.
    /DEBUGX  Shows the command parameters and exits
      /HELP  shows the switches in detailed (print this output).
         /?  shows a summary of the switches on one page.

  -----  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.
             The /ZX switch nullifies the effect of XXCOPYX setting.


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


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 file name before the long name
  was introduced.   However, due to the fact that the hyphen is now
  a legal character in Win32's long file name, 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.
  


[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #02



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: What are the differences between XCOPY and XXCOPY?
Date:    1999-11-27
====================================================================

Introduction:

  When we designed XXCOPY, one of the key design principles is to
  keep the command syntax and the behaviors 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) is 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 file name.  It always specifies the name
  of the destination DIRECTORY.

  The reason for this change was the confusing and bothersome
  behaviors of XCOPY.  For one thing, when you specify a non-existing
  directory as the destination of XCOPY, you would be greeted by the
  familiar prompt:
  
      Does XXXX specify a file name
      or directory name on the target
      (F = file, D = directory)?

  In most cases, we intended that to mean the destination directory. 
  Yet, because XCOPY allows the action to include renaming the file
  while it is being copied, this ambiguity arises.  It is simply
  carrying the legacy of the COPY command.  While the copy command's
  simplistic "rename-while-you-copy" features using a wildcard
  specifier works, we considers the action even 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
  many troubles and therefore we discourage you to use 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 the 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 experience
  with a 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 (and copy command treat the destination as
  a monolithic file rather than a directory which accumulates all
  the files in the source combined as a huge pile of useless bytes).
  Anyway, we had enough confusion with the double meaning of the
  destination specifier.  XXCOPY dares to change 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 in turn.  We consider this feature also 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 the 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, XXCOPY
  does not have the overhead of XCOPY which always runs the two
  programs (XCOPY.EXE and then XCOPY32.EXE next) 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 to Continue.
  
  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 with a modest sized network, with a networked environment,
  there are always a few files which are open at the time of a
  server backup job.  When a file which is currently opened by
  a process is accessed by XCOPY, it 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 exactly like the way XCOPY32's /C switch
  works.  When it was specified, an error condition will abort
  the entire copy operations, but will continue until all the
  qualified files are copied.  Alas, the most frequent technical
  support with the earlier versions of XXCOPY was the omission of
  the /C switch.  After answering many tech support Emails, we
  have reached to a 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
  behaviors exactly for better or worse.  Here, we made XXCOPY's
  implementation of the /C switch exact opposite of how XCOPY32
  handles the case.  We believe it is 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
  implied as the 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.


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 behaviors 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 "changes" which does
  not require much user attention for precautions.

  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:

  1. /X        exclusion specifier and related switches (/EX)
  2. /Bx       variations in backup related switches
  3. /N        retains the short name exactly
  4. /NS /NL   renaming short name and long name based on the other
  5. /D        date matching with many variations
  6. /Rx /Z    removes files using the versatile file selection schems 
  7. /ON /OA   creating a log file for serious backup management 
  8. /SX       flattening a directory tree
  9. /SZ       partial copy
 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@datman.com for comments, suggestions,
  questions, etc.


[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #03



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: Problems in file name aliases (8.3 names) in Win32
Date:    1999-11-27
====================================================================

Background:

  When Microsoft implemented the long file name 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 file names 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 file name 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:

   If your use a dual-boot system (Win95/98 and WinNT/2000), there
   is one more pitfall which is related to the shortname.
   Please read our new article, XXTB #08.
   

[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #04



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: What is and what is not included for copy
Date:    2000-01-18
====================================================================


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 the 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 exclusion parameter must by the
  filename itself.  The directory name is also a convenient way to
  say what to exclude.  The /X switch gives you a whole new way
  of excluding files and directories.  As a matter of fact, this is
  probably the most important way to exclude a group of files and
  directories.  Therefore, the /X switch deserves its own treatment
  in a separate article, XXTB #05.
  The important thing is the /X switch adds yet another way of
  specifying a group of files and directories to exclude.  It is
  indeed a very natural way of excluding a group of files.  Now, to
  come to think of it, how come, most other copy utilities do not
  have this option?


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.

  To further assist the user in constructing the right combination
  of the command switches, XXCOPY now has 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.

  Or, if you have not seen it before, try the following:
  
    XXCOPY . /OP | MORE  (it results in error but shows you the switches)  
   

[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #05



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: The Exclusion specifier
Date:    2000-01-18
====================================================================

Much of the mostly hidden power of XXCOPY lies in the exclusion
mechanism.  We identified the /X switch to be one of the most
important enhancements we made in the XXCOPY.  Because it is a
complex scheme with many implied rules, one cannot effectively
use the full potential of the exclusion feature without a detailed
explanation of the full scope of the syntax as well as the way
the exclusion scheme is implemented.  This article will discuss
all the rules applied to the exclusion feature.


XXCOPY Exclusion switch syntax 

  /X<xspec>       excludes the file or directory items 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.

  /ZX             ignores the environment variable, "XXCOPYX".
  
  XXCOPYX         The environment variable XXCOPYX specifies a
  (env var)       list of <xspec> which are separated by a space.

  XXCOPY          The environment variable XXCOPY  specifies a
  (env var)       list of XXCOPY switches which may be /X<xspec>.
  
  Note that the difference between the two environment variables,
  XXCOPY and XXCOPYX are that every item in the XXCOPY values   
  must be prefixed with a slash (/) followed by any XXCOPY switch
  whereas XXCOPYX values is strictly for an exclusion specifier list                  
  which does not use the /X prefix which is implied.

  You may specify as many exclusion specifiers as you like.


Some examples of the /X switches

  /Xc:\mydir\myfile.txt   ; specifies just a single file
  /X*.tmp                 ; all files that end with ".tmp"
  /Xabc*                  ; all files that start with "abc"
  /Xmydir\                ; the entire directory, "mydir" in the source
  /Xmydir\*\*             ; same as /Xmydir\ which is a shortcut
  /Xmydir\*\*.tmp         ; inside mydir, all files matching "*.tmp"
  /Xmy*xyz\*\abc*.c       ; inside mydir, all files matching "abc*.c"

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


     Syntax rule for the Exclusion List File.
     
         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 colons (::) and ends at the end of the line.
         We suggest the use of a line for each exclusion specifier which
         is followed by a comment.


Definition of the exclusion specifier.

    Up to now, the exact meaning of the exclusion specifier has not
    been defined.  Now, we are going to analyze the syntax and its
    meaning to its death.
    

    The exclusion specifier has up to three parts.

        [ dir_spec\ ] [ *\ ]  [ template ]
    
        Although any of the three parts can be omitted, you must not skip
        both dir_spec and template at the same time.
        
     Directory specifier ( dir_spec )

        The dir_spec part specifies the base directory of the exclusion.
        It is always followed by a backslash (\) character.
        The directory can be specified in an absolute path (starting with
        the root directory), or a relative path (without a leading
        backslash) which is treated as relative to the source directory
        (not the "current" directory).
        
        The base directory may contain a wildcard specification in its
        last part. For example
        
           /Xc:\mydir\level1\abc*\*\template
           /Xc:\mydir\level1\a*bc*.?oc\*\template
  
        In both of the examples here, the last part of the directory
        specifier (after \level1\) has asterisk(s) in it.  The second
        example goes one step farther by allowing multiple asterisks
        and even a question mark which is another wildcard for a single
        letter.
        
    The middle part (*\)
    
        It denotes that the exclusion specification will be applied
        not only to the dir_spec directory, but also all of the
        subdirectories underneath.  It is equivalent of the familiar
        /S switch which is applied to modify the source specifier
        meaning that the XXCOPY action will include all subdirectories.
        Since we do not have the luxury of a separate /S switch on each
        exclusion items, we invented this notation which figuratively
        suggests the fact that the directory starts with dir_spec,
        ends with the template and anything in between is accepted by
        the asterisk.

        The following two examples highlight the effect of the middle part.
        
          /Xmydir\myfile.*      ; myfile in mydir\ only 
          /Xmydir\*\myfile.*c   ; myfile in every directories under mydir\

     Template specifier ( template )

        The last part of the exclusion specifier is the template which
        matches the actual filename part (as opposed to the path
        specifier in the other parts).  Here, the template denotes
        a pattern of filename which may be applied to the filename
        part which may actually occur in the source.  You may use wildcard
        specifier for template, with any number of asterisk(*) and/or
        question mark(?).
        
        Note: earlier versions of XXCOPY had more restrictive rules in
        the usage of wildcard for template, but the restrictions are
        now gone.


Common shortcut notations of the exclusion specifier.
 
     1. template is interpreted as *\template

        When a template alone (without any backslash) is specified,
        it will be interpreted as a file pattern template which will
        be applied in all the subdirectories under the source directory.
        
        In order to specify a single layer pattern template, you should
        use the following notation.
        
          /X.\template  ; the dot denotes the current directory
                        ; relative to the source directory (no subdir)
          /X*\template  ; the template applies to all subdirectories
          /Xtemplate    ; a shortcut for /X*\template

     2. dir_spec\  is interpreted as  dir_spec\*\*

        As another very common case of exclusion where the entire
        directory, dir_spec will be excluded which is specified more
        precisely as
        
         /Xdirspec\*\*  ; everything in dirspec\ is excluded
         /Xdirspec      ; a shortcut for /Xdirspec\*\*

     Note that the following two are distinct:
     
         /Xdir_spec\*    ; one layer only (subdirectories not excluded)
         /Xdir_spec\*\*  ; the entire dir_sepc directory is excluded 


The five classes of exclusion specifiers.

    The exclusion specifier may be classified into the following five
    classes.

         Class A   *\template           ; applies to all subdirectories
         Class B   dir_spec\*\*         ; the entire directory
         Class C   dir_spec\*\template  ; template in all subdirectories
         Class D   dir_spec\*           ; any file in a single layer dir
         Class E   dir_spec\template    ; template in a single layer dir


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.  For example, if a dir_spec is specified in Class B,
    any subdirectories of the same directory in Classes C, D, or E
    regardless of the template will be automatically excluded because
    the same directory in Class B spec overshadow any subset of the
    directory.  Moreover, in the actual XXCOPY implementation, the
    the active file pattern matching templates is computed to each
    subdirectory to reduce the number of file name matching to 
    significantly reduced number of combinations.


Debug feature
    
    Because of the complexities of the exclusion parameters when the
    number of exclusion specifiers become substantially large,  you may
    analyze the list of exclusion parameters immediately after the
    initial exclusion parameter optimization steps are completed by the
    following two debug switches:
    
      /DEBUG    ; displays the parameters and prompt for continuation
      /DEBUGX   ; displays the parameters and exit XXCOPY.
      /OX       ; outputs the exclusion parameters in the log file
      /OP       ; outputs the regular parameters in the log file.


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 always excluded implicitly.


[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #06



From:    Kan Yabumoto           tech@datman.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) 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 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.

    Well, XXCOPY will do what Microsoft fails to do.
    
        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   Ignores the Archive bit  (default)
     /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    Overwrites a read-only file if necessary

    Destination file attributes

     /K0   Keeps the source attributes except the Rdonly bit (default)
     /KS   Keeps the source attributes including the Rdonly bit
     /KD   Keeps the attributes of destination (overwritten) file
     /KN   Sets the destination attributes to norma (only /A)

[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #07



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
SANAE121 Handling the case of Cyclic Copy.
Date:    2000-02-11
====================================================================

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:   

    Smart programs such as XCOPY have a detection mechanism to avert
    this disastrous situation.

    In many cases it is prudent for the copy utility to detect and avoid a
    cyclic copy.  After all, most such cases are simply a user mistake.
    Therefore, that was certainly adequate for XCOPY.  That's Microsoft.  

    But, in other cases, you just want to create a copy of the whole
    volume into another subdirectory (of course, by excluding the
    destination).


Cases where a Cyclic Copy is useful:   
    
    It is certainly true with a combination with other switches such as
    /SZ0 (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 always without prompt.
            (this is the default behavior --- compatible to XCOPY).

    Note that although the /CC and /CCY action is internally
    equivalent to specifying the destination directory using the /X
    switch, you must explicitly use the /CC or /CCY switch in order
    to continue the copy operation with a cyclic copy condition.


A few interesting examples using /CCY:

    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 /SZ0
 
           This one includes files without copying the file contents
           (creates zero-length files corresponding to the source).


[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #08



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: Short names made by Win95/98 and by WinNT/2000.
Date:    2000-03-07
====================================================================


In our earlier article, XXTB #03, we discussed the subtle problem
of long and short file names 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 file names, 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 file name 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 variations.
  
	 Longname         Windows 95/98    Windows NT4/NT5/2000
       ----------------------------------------------------------
	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).
   We have no idea what was in Microsoft programmers' mind.  We cannot
   think of any advantage in it.  Nevertheless, we have to deal with
   the consequences...


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.
   
   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 his 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 file names 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 or
   vice versa), we suggest you turn off XXCOPY's short name
   preservation switch by /N0 in order to avoid the time consuming
   and futile effort by XXCOPY.


[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #09



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: World Wide Network of Download Sites for XXCOPY
Date:    2000-03-28
====================================================================

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.Com which provides this service.


XXCOPY Freeware ver 2.24.2  (xcpy2242.zip)

US, ALL (primary) ftp.simtel.net
US, Arizona ftp.datacanyon.com
US, California ftp.cdrom.com
US, California ftp.digital.com
US, Georgia ftp.usg.edu
US, Illinois uiarchive.cso.uiuc.edu
US, Massachusetts ftp.bu.edu
US, Michigan oak.oakland.edu
US, Missouri galileo.galilei.com
US, New York ftp.rge.com
US, Oklahoma ftp.ou.edu
US, Oregon ftp.orst.edu
US, Pennsylvania ftphost.simtel.net
US, Virginia mirrors.aol.com
Australia mirror.aarnet.edu.au
Australia sunsite.anu.edu.au
Austria, Vienna ftp.univie.ac.at
Belgium ftp.freegates.be
Brazil ftp.customcdrom.com
Brazil ftp.iis.com.br
Brazil ftp.unicamp.br
Bulgaria ftp.eunet.bg
Canada, Alberta ftp.telusplanet.net
Canada, Ottawa ftp.crc.ca
Canada, Vancouver ftp.direct.ca
Chile sunsite.dcc.uchile.cl
Czech Republic ftp.eunet.cz
Czech Republic ftp.zcu.cz
Czech Republic pub.vse.cz
Denmark ftp.net.uni-c.dk
Finland ftp.funet.fi
France ftp.grolier.fr
Germany ftp.freenet.de
Germany ftp.mpi-sb.mpg.de
Germany ftp.rz.ruhr-uni-bochum.de
Germany ftp.tu-chemnitz.de
Germany ftp.uni-heidelberg.de
Germany ftp.uni-paderborn.de
Germany ftp.uni-trier.de
Germany ftp.rz.uni-wuerzburg.de
Greece ftp.ntua.gr
Hong Kong ftp.comp.hkbu.edu.hk
Hong Kong ftp.cs.cuhk.hk
Hong Kong sunsite.ust.hk
Hungary ftp.iif.hu
Ireland, Dublin ftp.heanet.ie
Ireland, Dublin ftp.iol.ie
Italy cis.uniroma2.it
Italy ftp.flashnet.it
Italy ftp.unina.it
Italy mcftp.mclink.it
Japan ftp.iij.ad.jp
Japan ftp.riken.go.jp
Japan ftp.saitama-u.ac.jp
Japan ftp.u-aizu.ac.jp
Japan ftp.web.ad.jp
Latvia ftp.lanet.lv
Malaysia ftp.jaring.my
Mexico ftp.gdl.iteso.mx
Netherlands ftp.euro.net
Netherlands ftp.nic.surfnet.nl
Norway ftp.bitcon.no
Norway ftp.fikas.no
Poland ftp.cyf-kr.edu.pl
Poland ftp.icm.edu.pl
Poland ftp.man.poznan.pl
Romania, Timisoara ftp.dnttm.ro
Russia ftp.chg.ru
Singapore ftp.nus.edu.sg
Singapore ftp.singnet.com.sg
Slovakia ftp.uakom.sk
Slovenia ftp.arnes.si
South Africa ftp.is.co.za
South Africa ftp.saix.net
South Africa ftp.sun.ac.za
South Korea ftp.kornet.net
South Korea ftp.sogang.ac.kr
South Korea sunsite.snu.ac.kr
Spain ftp.rediris.es
Sweden ftp.sunet.se
Switzerland sunsite.cnlab-switch.ch
Taiwan nctuccca.edu.tw
Turkey ftp.ulak.net.tr
UK, London ftp.demon.co.uk
UK, London ftp.easynet.net
UK, London ftp.globalnet.co.uk
UK, Lancaster mirror.ac.uk
UK, London sunsite.doc.ic.ac.uk

[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #10



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: Cloning the system disk using XXCOPY.
Date:    2000-04-17
====================================================================

I found many messages posted in various newsgroups are talking
about duplicating the entire hard disk to another.  In particular,
the case involving the boot disk (C:) are most commonly discussed
probably because there are a few pitfalls that are frequently
encountered even for experienced users.  To be honest, the popularity
of XXCOPY for disk cloning is a bit surprise for me.  XXCOPY appeared
in the following discussion groups in recent months:

    alt.msdos.batch
    alt.msdos
    alt.windows98
    comp.sys.ibm.pc.hardware.storage
    microsoft.public.win98
    comp.os.ms-windows.setup.win3x

In this article, I would like to address the most common problems
and questions that are asked in the newsgroups.


1.  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 make the
    new one as 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 with
    ample room left.  After 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:.

    Now, let me start, step-by-step, from the beginning where you
    just powered up the machine for the first time after you added
    the new drive.  From the command prompt of DOS (or a DOS Box),
    run FDISK.EXE which is usually found in C:\windows\command\.

        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%).  When you exit FDISK,
    you should reboot the system and reenter Windows 9x and go back
    to a DOS Box.  FDISK assigned the new drive a drive letter but it
    is not ready for normal access without the logical format procedure
    which initializes the drive.

        FORMAT D:

    Here, be extremely careful.  The drive letter shown here (D:) may
    not be the correct one for your computer, depending on how many
    other drives and/or partitions are set up.
    
    When you have the new disk drive FDISKed, and FORMATted, you are
    ready for the XXCOPY job, making a logical duplicate of another
    drive (often, the system/bootable disk volume). 


    A minimal version (good when the new drive is empty)

      Batch file contents (one-liner)
      ----------------------------------------------------------
       XXCOPY C:\  D:\  /h/e/ks
      ----------------------------------------------------------

    A versatile version (good even when the new drive is NOT empty)

      Batch file contents (one-liner)
      ----------------------------------------------------------
       XXCOPY C:\  D:\  /h/e/r/y/ks/zy
      ----------------------------------------------------------

      Explanation:
       
        /h    ; copies hidden and system files
        /e    ; copies subdirectories (including empty ones)
        /r    ; overwrites read-only files if such files exist
        /y    ; overwrites existing files without prompt
        /ks   ; keeps source files' attributes exactly
        /zy   ; deletes extra files in destination if present

    Here, I showed two variations; the second one is superior.
    This XXCOPY step probably takes a very long time.  Performance
    varies by the system, typically anywhere 1-10 Gigabytes per hour.
    If your system has an Anti-Virus scan utilities, and other disk
    utilities which keep track of various disk activities, I
    strongly suggest that you turn off all such programs at this time.
    But, you can run this long procedure as a background process;
    feel free to do other chores using the computer.  Later, you
    will run XXCOPY once more to pick up any files which are modified
    while this lengthy XXCOPY job is being performed.

    While you are waiting for the disk-to-disk copying step, make
    sure that you have a system diskette handy.

          ----------------------------------------------------------
           If you don't have one, open up another DOS Box and run
    
               FORMAT A:\  /S

           The /S switch makes it a system diskette which can bootup
           the system into DOS (ver 7.x).
          ----------------------------------------------------------

    When the main XXCOPY is completed, it will show you some statistics
    of the operation.  In most cases, you will find many files which
    have failed to copy.  Now, you are at the final step.  Close all
    applications, and run XXCOPY once more to pick up files that are
    modified while you were running XXCOPY the fist time. 
    
       XXCOPY C:\  D:\  /h/e/r/y/ks/zy/bi/q

    The /bi switch which stands for "Backup, Incremental" skips files
    which already exist in the destination with the same size and time.
    The /q switch limits the console output to the files that are
    actually being copied.  This step should be much shorter than
    the first time.  If no other applications are ruining, you may
    not find any file copied or failed to copy.  But, a typical Win9x
    system has the virtual memory swap file (WIN386.SWP) mapped in the
    main drive (C:) which always fails to be copied.  Just disregard
    the swap file.

       Tip: mnemonically rearrange the switch to /ks/h/e/r/q/y/bi/zy
            which reads "Kiss her quick. Yes, but I'm busy".

    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
    (drive parameters).  Also make sure that your system will boot up
    from the diskette when it is present (also configured in BIOS's
    advanced setting menu). 

    Although the new hard disk contains pretty much everything, it
    is still not bootable.  So, you need to run FDISK once more to
    make the new drive's main partition the "Active Partition".
    Reboot from the floppy now (discussed above). The new Drive C: is
    now fully accessible;  you may test it by 
    
       DIR C:\WINDOWS\COMMAND\FDISK.EXE

    This is what you need.  Run the FDISK utility from the disk.
    
       C:\WINDOWS\COMMAND\FDISK.EXE
       
    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).


    Note:  This technique works if you use XXCOPY.  But, if you use
           Microsoft's XCOPY, your new drive will not likely to boot
           correctly due to subtle differences in copying files.


2.  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. 
        
    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.  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/e/i
     XXCOPY C:\Windows\system  D:\Windows\system   /h/r/y/ks/zy/e/i
     XXCOPY C:\Windows\fonts   D:\Windows\fonts    /h/r/y/ks/zy/e/i
     XXCOPY C:\Windows\inf     D:\Windows\inf      /h/r/y/ks/zy/e/i
     XXCOPY C:\Windows\command D:\Windows\command  /h/r/y/ks/zy/e/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. 


4.  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 every 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@datman.com.



[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #11



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: XXCOPY Cookbook: Recipes of common usages
Date:    2000-04-18
====================================================================

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

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


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

  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 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.
    
    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 /SZ0 /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 /SZ0 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 /SZ0 /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 suprior 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 /SZ0 forces the file size to
    be different (0 byte) for nearly all files, almost all files
    would be rewritten.  


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






This page is still under construction...




[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #12



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: The file removal feature.
Date:    2000-04-18
====================================================================

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 starts where Microsoft's
  imagination ends.
  
  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 add 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 remove 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 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.

    Note:

        In some cases, you may perform an exactly the same file
        removal operation using either the /RS or the /RD switch
        (using different arguments, of course).  But, you should
        use /RS as much as possible because it is more straitforward.
        
        When you use /RD in combination with a switch which uses the
        source file's characteristics (e.g., /DB#5 --- files more
        than 5 days old), the file in the source directory is checked,
        not the one which actually gets removed.


Suppressing the confirmation prompt.

  Since file removal is a serious business, XXCOPY always asks you
  for confirmation before removing a file.  Of course, in a batch
  file, you normally do not want such confirmation.  For file copy
  operations, the regular /Y (and /-Y to negate it) switch controls
  the suppression of Yes/No prompt.  Here, with the /RC switch which
  still performs copy operation is controlled by the /Y and /-Y
  setting.  Therefore, the Remove-after-Copy (/RC) operation provides
  another step of confirmation for file removal.  To control the
  second confirmation, the following variations to the /RC switch
  are available.
  
    /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.
  
    /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.
 
    
    /R0   Undo any of the /RC, /RS, /RD, or /RX switches


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, "myfile.*" 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 file names 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.


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.



[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page















































DATMAN Home Page
[ Back to Table of Contents ]

XXCOPY TECHNICAL BULLETIN #90



From:    Kan Yabumoto           tech@datman.com
To:      XXCOPY user
Subject: Revision History of XXCOPY.
Date:    2000-04-19
====================================================================


 Version   Date

 2.20.0   1999-10-01    XXCOPY debuted under the new name.
 2.21.9   2000-01-07    the limit on # of exclude items removed
 2.22.0   2000-01-14    /X and /EX made better
 2.22.2   2000-01-14    New switch, /DA#n (relative # days from today) 
 2.22.8   2000-02-11    New switch, /CC and /CCY (auto-exclude on cyclic copy)
 2.22.9   2000-02-16    New switch, /AA /AZ
 2.24.3   2000-03-13    /K and /KS now work with directory attributes.  
 2.25.1   2000-05-07    /CLONE, a shortcut for /KS/H/E/R/Q/Y/BI/ZY
                        New switches /RC/RS/RD/RX, for file removal.


Note:  the second digit in version number denotes a beta test version
       if it is an odd value.  For example, Ver 2.34.6 is a beta test
       version which is equivalent of release version ver2.24.6.



[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page


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

XXCOPY is compatible with Windows95, Windows98, WindowsNT, and Windows2000.
XXCOPY16 is compatible with practically all versions of MS-DOS, and non-
Microsoft DOS variations such as DR-DOS.  XXCOPY16 can also be executed in
a DOS Box of Win95.

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

[ Table of Contents ] [ DATMAN Home Page ]

DATMAN Home Page