home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 6 File
/
06-File.zip
/
dircomp.zip
/
dircomp.inf
(
.txt
)
< prev
Wrap
OS/2 Help File
|
1999-05-25
|
12KB
|
252 lines
ΓòÉΓòÉΓòÉ 1. Introduction ΓòÉΓòÉΓòÉ
DIRCOMP is a command line utility which allows you to compare two directories
and check if there are files that do not match. This may be of importance if
you have to maintain both a network volume and a local drive on which files
have to be the same. It may also be suited for incomplete backups to see which
files did not make it into the backup.
In contrast to contemporary "fashion" this program was designed as character
mode application mainly because:
Γûá the programmer is not familiar with PM programming.
Γûá typical users of the application dislike use of the mouse.
Γûá output can be redirected to NUL.
The entire project is a result of private research of the programmer to get
acquainted with programming of OS/2-API. Therefore, this utility comes to you
as freeware with the author hoping to give you a reliable and fast utility to
work with. It has to be mentioned that there is already a powerful tool to
compare directories, delivered by COOLWARE. So in case you are dissatisfied
with this application you should try PMDIRENF which offers several functions
more and which is freeware, too.
No further development of the product is intended, except elimination of bugs
that may still wait for detection. First it was planned to bring out a version
out for Windows NT but such kind of utility is supplied with the Resource Kit.
ΓòÉΓòÉΓòÉ 2. How to invoke DIRCOMP ΓòÉΓòÉΓòÉ
At command line prompt type in:
DIRCOMP [options] [directory][file pattern] [directory]
and the utility will list all mismatches of the two designated directories.
Normally, you enter something like this:
dircomp *.exe d:\os2
Implicitly you want to compare all executables in your actual directory with
all executables that reside in directory OS2 of drive D.
In case you only enter a directory name, DIRCOMP selects all files, i.e. all
files matching '*'.
ΓòÉΓòÉΓòÉ 2.1. Options ΓòÉΓòÉΓòÉ
Options for DIRCOMP are quite similar to those of the built-in-command DIR of
CMD.EXE which means that you can select attributes of the files you want to
match. Options must start with a slash character followed by at least one
letter. Unlike command-line utilities based on UNIX-systems, DIRCOMP does not
support the dash character since the file pattern to be matched may start with
such a character, e.g. "-dash*.txt". Since it is default for OS/2 command line
programs, options do not have to be typed in before arguments to the program,
e.g., you give the command:
dircomp *.exe /a:r d:\os2 /p
Options available are:
/?
/A[ADHRS]
/B
/L
/P
/S
/T
Note that ordering of files is not implemented. See Programmer's Perspective
for details.
ΓòÉΓòÉΓòÉ 2.2. Output ΓòÉΓòÉΓòÉ
DIRCOMP lists those files that either differ from each other in last-access
date, last-access time or size or non-existence on either of the two designated
directories. It does not list the actual directory nor the directory above.
For example: You typed in DIRCOMP D: M: /A-D , you could get:
D:\* M:\*
10.04.96 23:37:12 3935 0 CONFIG.001 LLL
09.04.96 21:21:10 4338 0 CONFIG.BAK LLL
27.04.96 00:23:26 4342 0 CONFIG.SYS LLL 10.04.96 23:37:12 3935 0
CONFIG.SYS
10.04.96 21:58:14 1462272 0 EA DATA. SF LLL
22.04.96 14:09:24 76 35 STARTUP.CMD RRR 04.06.96 22:00:06 111 0
STARTUP.CMD
04.06.96 21:40:24 271 0 WP ROOT. SF LLL 12.05.96 20:37:02 271 0
WP ROOT. SF
ΓòÉΓòÉΓòÉ 3. Programmer's Perspective ΓòÉΓòÉΓòÉ
DIRCOMP has been designed as a kind of study how to combine both multithreading
and recursion in a single program. As it has been said earlier, I wanted to
know how to handle OS/2 Control Program API. This included semaphores,
designing threads and perform some error-message handling as well. It would
have been nice to do PM also, but when I thought of the user, I soon realized
that a windowed application without use of VIO was the proper solution. It
should still be usable even if you have to boot from the emergency disks and I
think that typing in pathnames is much quicker than using file-selector-boxes.
I looked at PMDIRENF and I felt a little uncomfortable with so many operations
I could execute when all I wanted was to list all mismatches of dedicated
directories.
During the development of this tool, I was strongly in favour of creating a
dual-purpose utility that could have been used as both a directory comparison
program and a substitute of the existing DIR-command because of the fact that
DIR has a limitation with respect to ordering (just in case someone does not
organize well his directory structure and collects a large number of files in a
single directory - we happened to see such thing). So, I first took effort to
build an application being as close to the command mentioned above. I
implemented ordering of file by size etc. and handling of file attributes.
Instantly, I was very surprised about DosFindFirst's behaviour regarding file
attributes. Nevertheless, it was low a hurdle to take. After I spent some time
on ordering, it turned out be irrelevant to my main task: directory comparison.
So, I did not bother with substituting DIR any longer, and I dropped the
feature that file entries were displayed in a user-defined ordering.
Interestingly, as this project had nearly been finished, I got a glance at NT's
Windiff utility, shipping with the Resource Kit. It works slightly different to
my program as it also compares the files themselves. This is surely more
convenient than my method of checking file entries only. Nevertheless, I did
not improve the program since a differential file compare utility is available
as part of the GNU project. By the way, I was confirmed in designing DIRCOMP as
a command line tool. Although Windiff is primarily an application using the
standard Windows-GUI it can be invoked from command line as well, saving output
to a file.
Please note that this project was born purely out of curiousity, and the
underlying algorithm is not to be considered as optimal, just one out of a set
of possibilities. For those who are interested in performance, I have added the
timing option /T.
DIRCOMP has been developed using the EMX/GCC v0.9a package with method E3, so
there is no need for an accompanying DLL, even if this means that the
executable file increases in size (Ever thought of purchasing a new high
capacity volume? Disk space is cheap these days). I have to thank all
contributors to the EMX/GCC development system since it is still my first
choice, despite of heavy competition from commercial suppliers of compilers
(including the manufacturer of this operating system).
ΓòÉΓòÉΓòÉ 4. Revision Information ΓòÉΓòÉΓòÉ
Version 1.00 - Initial Release in July 1996
Version 1.01 - Dec 1996, minor corrections applied, public availability May
1999
ΓòÉΓòÉΓòÉ 5. Disclaimer ΓòÉΓòÉΓòÉ
This software is provided "as is" with no warranty. The author makes no
representation, or warranty, either express or implied, with respect to the
program, its quality, accuracy, or fitness for a specific purpose. Therefore,
the author shall have no liability to you or any other person or entity with
respect to any liability, loss, or damage caused or alleged to have been caused
directly or indirectly by the program provided. This includes, but is not
limited to, interruption of service, loss of data, loss of classroom time, loss
of consulting or anticipatory profits, or consequential damages from the use of
the program.
ΓòÉΓòÉΓòÉ 6. Copyright ΓòÉΓòÉΓòÉ
This software is protected by international copyright law, regardless of the
fact that it is freeware. This means, you are allowed to make copies of the
files and distribute it. The only restriction is that all files have to be
distributed together.
(c) 1996, by Axel Meiss
All rights reserved.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
This message shall remind you that it is very important to keep backups of your
files. You don't care? Good luck!
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
OS/2 is a trademark of IBM Corp.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Windows NT is a trademark of Microsoft Corp.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Coolware
PO Box 18863
Atlanta, GA
31126
CompuServe id : 76500,2557.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Get a short info on invoking DIRCOMP.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Specifying this option means that you want to include/exclude those files which
do/do not match the given attribute
Example:
dircomp *┬╖exe d:\os2 /A:A-R
all executables in the actual directory and directory OS2 of drive D having the
attribute ARCHIVE but which have not the READ-ONLY-attribute set.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Displays file names only
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Displays version information
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Displays all mismatching file names in lower case. Otherwise, file names will
be displayed as they were created, i.e. on a HPFS file system cONfiG.sYS
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Waits for a keystroke after one page has been displayed.
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Want to include subdirectories also? Bingo, you made it! Why not comparing
complete drives? It's so easy if this option is set
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Display time of execution in milliseconds
ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
Windows is a trademark of Microsoft Corp.