<tech@datman.com>
Ready to download? Click here --> Start Download
The latest release (this page revised on 2000-01-29) XXCOPY Version 2.22.5 2000-01-30 XXCOPY16 Version 1.22.2 1999-11-30
(XCPY2225.ZIP)
via FTP
If you have problem with FTP, try this --> Alternate Download via HTTP
XXCOPY Technical Bulletins (Reference)
XXTB #01 ... XXCOPY Command Parameters Reference
XXTB #02 ... What are the differences between XXCOPY and XCOPY?
XXTB #03 ... Problems in file name aliases (8.3 names) in Win32.
XXTB #04 ... What is and what is not included for copy.
XXTB #05 ... The Exclusion specifier.
XXTB #06 ... File Attributes: what are they and how to use them.
Phone = +1-630-369-7112 Fax = +1-630-369-7113 E-Mail = <sales@datman.com> Web Home = http://www.datman.com/
From: Kan Yabumoto tech@datman.com To: XXCOPY user Subject: XXCOPY Command Parameters Reference Date: 2000-01-11 ==================================================================== 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. /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 system files also. /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 newer/older files only (includes brand new files). /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 ----- The following switches limit files by file dates ----- /D[:date] Same as /DA[:date] /DA[:date] Copies files changed on or after the specified date. /DB[:date] Copies files changed on or before the specified date. /DO[:date] Copies files 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 changed today or later. /DB:. Copies files changed yesterday or earlier. /DO:. Copies files 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 If no date is given, copies only those files whose source time is newer/older than the destination time. In that case, it is very similar to /BN or /BO except it can be combined with another /B switch (e.g., /BI) Since the US and European conventions are not reconcilable, we recommend the ISO 8601 standard (YYYY-MM-DD) with a 4-digit 2-digits, it is interpreted according to the system setting. year value followed by month and day. If all values are with 2-digits, it is interpreted according to the system setting. /D or /DA Copies newer files and brand new files. /DB Copies older files and brand new files. ----- 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 or both 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. May be used to modify /T. /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories. /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). ----- 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 charactter 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.
From: Kan Yabumoto tech@datman.com To: XXCOPY user Subject: What are the differences between XXCOPY and XCOPY? 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. 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. /Z deletes extra files in the destination 7. /ON /OA creating a log file for serious backup management 8. /SX flattening a directory tree 9. /SZ partial copy 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.
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.
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 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)
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 sourrounded 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 a 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 exclusion specifier notation. 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 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\*\* 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.
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 is 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 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 Archive attribute which are either newly created or modified in any way since all the Archive attributes are cleared the last time. As the XCOPY the "officially" designated system archive utility in MS-DOS with the feature to check and to clear the Archive attribute, the Archive attribute had its usefulness. XCOPY (and also XXCOPY) has the /A and /M switches which both performs a copy operation only on files with the Archive attribute set. But, the /M switch is the one which clears the Archive attribute after a successful copy is made. However, there are many backup and archive utilities that are capable of clearing the Archive attribute. Then the question becomes which utility or application program is responsible in clearing the archive bit. Since there is no mechanism in any of the operating systems to ensure that only one such utility is designated to handle the Archive bit. If two or more backup schemes are used at the same time, they will compete one another and none of them would save a complete set of backup files. 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. Instead, 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. Once you give up the use of the Archive attribute for your incremental backup regime, the Archive attribute becomes even more useful for temporary usage. We will show you two such uses. 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. 2. When you need to copy a directory on a set of diskettes, you can first set all the files with Archive attribute set first. Then, run multiple runs of XCOPY /M (or XXCOPY /M). The copy will terminate as soon as the diskette becomes full, but the files which has already been copied are cleared of the Archive attribute and therefore will not be selected in the subsequent runs of XCOPY. 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) Hidden and System bit /H0 Excludes files with Hidden or System Attributes bits (default) /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)
============================================================================== 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. ==============================================================================