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