home *** CD-ROM | disk | FTP | other *** search
-
- ╔════════════════════════════════════════╗
- ║ ║
- ║ ║
- ║ THE DIRECTORY DICER (version 1.1) ║
- ║ ║
- ║ ║
- ╚════════════════════════════════════════╝
-
-
- Copyright 1990 by A. Preston Moser
-
-
- This program is being bundled with DoTree, a command executor.
- While DoTree is a public domain program, DI.COM is not. DI.COM is a
- Charware program with proceeds going to The Hunger Project. See TERMS
- AND CONDITIONS below.
-
-
- SETUP
-
- To set up the Directory Dicer, simply place the DI.COM file in
- one of the directories in the computer's PATH. (That is, one of
- the directories named in the path command in the autoexec.bat file.)
- Putting this program in the first directory listed in your path
- command will increase the access speed.
- In my CONFIG.SYS file I set up a RAMDRIVE. I then have my AUTOEXEC.BAT
- file copy my most often used utility programs into the Ramdrive, and I
- make the Ramdrive the first directory in my path command. This speeds
- things up and lessens the strain on the hard drive.
-
- GETTING STARTED
-
- At any time when you would normally type DIR to get a listing of
- the files in a directory, instead, type DI. (That's one less letter
- you'll have to type). You will find that the directory is listed much
- the same way that it is with DIR with a few notable exceptions:
-
- 1) All subdirectories will be listed first, and in alphabetical order.
-
- 2) All of the files will be listed (also in alphabetical order).
-
- 3) The display pauses after each screenful instead of scrolling off
- the screen before it can be read.
-
- 4) Pressing ESC will cause the program to exit to DOS immediately (unless
- it is executing a command from the DOS shell, but more on that later.)
-
- 5) The list of filenames will include commas in the file size number
- for greater readability.
-
- 6) Information about whether the file is Read-only, Archived, System, or
- Hidden is given at the right side of the listing.
-
- 7) After all of the files have been listed, the program gives the sum of
- the file sizes in addition to how many files were found and how much
- free space remains.
-
- So far, so good, but wait! There's much more!
-
-
- SORTING OPTIONS
-
- By default, all files will be listed alphabetically by filename.
- You can tell the program to list the files sorted by Size, Date and time,
- Extension, or you can have the files Unsorted. This is done by adding
- a "/S", "/D", "/E", or "/U" (respectively) after the command. Adding
- "/R" either by itself, or with one of the other sort options, will Reverse
- the order in which the files are displayed.
-
- DOUBLE DIRECTORY DISPLAY
-
- If you give the program the name of two directories (separated by
- a space,) it will print both directories side by side for easy comparison.
- Thus, entering "DI . \/d/r" will cause the current directory and the root
- directory to be displayed side by side, sorted by Date and time, with the
- newest files listed at the top. (Note that there must be a space between
- the two directory names, but there doesn`t have to be a space between the
- second directory name and the options.)
-
- Page 3
- USING SIGNS
-
- The DI program can be used to compare two directories and to list
- the files in the first directory for which there is a matching filename
- in the second directory. If, for instance, there were two directories
- containing the following files:
-
- Directory #1 - C:\TEXT
-
- LETR11.TXT 3,421 bytes Jan. 14, 1988 1:30p .A..
-
- RESP01.TXT 5,123 bytes Jan. 27, 1988 11:15a .A..
-
- NOTE_2.DOC 23,332 bytes Sep. 15, 1989 4:20p RA..
-
- PROG_NOT.DOC 1,462 bytes Mar. 27, 1987 2:15p ....
-
- MYNOTES.TXT 7,878 bytes Feb. 8, 1990 9:21a .A..
-
- READ.ME 2,731 bytes Apr. 22, 1986 12:01a .A..
-
- Directory #2 - C:\WPDOC
-
- LETR22.TXT 17,899 bytes Aug. 7, 1988 12:01a .A..
-
- READ.ME 47,592 bytes July 4, 1987 10:36a .A..
-
- LETR11.TXT 3,421 bytes Jan. 14 1988 1:30p .A..
-
- RESP01.TXT 8,432 bytes Feb. 2, 1988 3:14p .A..
-
- PROG_NOT.DOC 1,462 bytes Mar. 27, 1987 2:15p RA..
-
- ... And you were to enter the command "DI \TEXT = \WPDOC" while
- you were in the "C:\NOTES" directory, the following files would be listed:
-
- LETR11.TXT 3,421 bytes Jan. 14, 1988 1:30p .A..
-
- PROG_NOT.DOC 1,462 bytes Mar. 27, 1987 2:15p ....
-
- READ.ME 2,731 bytes Apr. 22, 1986 12:01a .A..
-
- RESP01.TXT 5,123 bytes Jan. 27, 1988 11:15a .A..
-
- As you can see, those files with the same name were listed (in
- alphabetical order). If you enter the command "DI \TEXT - \WPDOC",
- (read that "TEXT directory MINUS the WPDOC directory") then the
- files listed would be those files in the first directory for which
- there were no matching filenames in the second directory. In our
- example the results would be:
-
- MYNOTES.TXT 7,878 bytes Feb. 8, 1990 9:21a .A..
-
- NOTE_2.DOC 23,332 bytes Sep. 15, 1989 4:20p RA..
-
- Notice that LETR22.TXT would not be printed even though it is
- in the second directory but not the first. Only files from the first
- directory will be printed.
-
- Page 4
-
- There are two options that work with the "=" sign. They are "/M" and
- "/N". If you enter the command "DI \TEXT = \WPDOC /m", you will get those
- files whose names, dates, times, and sizes all Match exactly. For our
- example you would get:
-
- LETR11.TXT 3,421 bytes Jan. 14 1988 1:30p .A..
-
- PROG_NOT.DOC 1,462 bytes Mar. 27, 1987 2:15p ....
-
-
- Thus, the "/M" option (M for Match) will only pass those files that APPEAR
- to be identical. The DI program does not compare the data in the files,
- it only compares their directory listings. Furthermore, the file's attributes
- (Read only, Archive, System, and Hidden) are not compared.
- Entering the command "DI \TEXT = \WPDOC /N" causes the following files
- to be named:
-
- RESP01.TXT 5,123 bytes Jan. 27, 1988 11:15a .A..
-
- READ.ME 2,731 bytes Apr. 22, 1986 12:01a .A..
-
- That is, those files with matching filenames whose date, time, OR size
- do Not match (/N is for Not match) will be listed.
-
- It should be noted that two files that are created a few seconds apart,
- but within the same minute will not have the same date and time number even
- though they appear the same when listed with DI or DIR. For, while the DIR
- command in DOS or the DI program show the time in hours and minutes, the
- actual number that is stored includes seconds in two second increments.
-
-
- THE ".DIR" FILE
-
- So far we have discussed two of the three possible signs ("=" & "-".)
- There is one more sign that has not been mentioned, namely the "}", or
- right brace. To use this sign with the example above we might enter the
- command "DI \TEXT } TEXTFILS". To do so would create a file named
- TEXTFILS.DIR which would contain all of the directory information for each
- of the files in the C:\TEXT. The length of the file would be the number of
- files in the directory * 22. The file that was created could then be used
- as the second directory in subsequent DI commands. For instance, three weeks
- after creating the TEXTFILS.DIR file you could enter the command
- "DI \TEXT = TEXTFILS /n" and you would see a list of any files that had been
- changed in the last three weeks. (It would not, however, mention any files
- that had been deleted.) If you suspected that any files had been deleted,
- you could enter the command "DI \TEXT TEXTFILS" and you would see the files
- from the \TEXT directory and the TEXTFILS.DIR file displayed side by side.
- There is another way of viewing the data that bears mentioning now.
- In our example above, if we had entered the command as "DI \TEXT TEXTFILS /M"
- then the files would have been listed side by side, but they would have
- been staggered according to the sort criterion, with files that had the
- same name (when sorting alphabetically) side by side.
- In the first example, I mentioned that we were issuing the command
- from the C:\NOTES directory. If that were the case when we created the
- TEXTFILS.DIR file in the example above, then the TEXTFILS.DIR file would
- have been placed in the C:\NOTES directory, and we would have had to run
- the comparisons from the same directory, or made the command look like
- "DI \TEXT = \NOTES\TEXTFILS/n".
-
- Page 5
-
- The ".DIR" files created by the DI program cannot easily be read by
- a normal text editor or word processor, because the file contains numbers
- that are in binary format instead of ASCII text format. Furthermore,
- the files do not contain carriage returns. Consequently, to a text editor
- or a word processor, all of the data will appear to be on one very long line.
- If you would like to be able to read the list of filenames, you can create
- the file using the command "DI \TEXT } TEXTFILS /T". The "/T" option
- (T for Text mode) causes all of the numerical data in the file being
- created to be replaced by spaces and a final carriage return. The resulting
- file will have the same length as the file created without the "/T" option,
- but you should have no trouble reading it with a text editor or the DOS TYPE
- command. The .DIR file in text format can still be used by the DI program,
- but the /M and /N features will no longer work.
- If you wish to edit a text mode .DIR file, you should do so VERY
- CAREFULLY. In order for the file to still be usable by the DI program,
- the number of spaces after each filename must be maintained. Each line
- of the text mode .DIR file should contain the filename in upper case
- letters followed by spaces and a carriage return. The number of spaces
- added to the number of characters in the filename should equal 20.
- The "}" sign can also be used to add more files on to the end of an
- existing .DIR file, however, the program will not check for duplication
- of filenames in the .DIR file.
- Adding files to a .DIR file with the /T option will cause all of the
- files in the .DIR file to be converted to the text mode. Once a .DIR file
- has been created in text mode or converted to text mode, all files that
- are later added to that file will be added in text mode whether a /t
- option is given or not.
-
- THE EXECUTE OPTION
-
- Perhaps the most powerful function of the DI program is the "/X"
- option. An example of its use is "DI \TEXT = \WPDOC /XCOPY TEXT\%1 A:\".
- In this example, those files in the \TEXT directory that are also named
- in the \WPDOC directory will be printed. After each file is printed,
- the command "COPY TEXT\FILENAME.EXT A:\" will be executed with the name
- of each file in the place of the "%1". Therefore, all of those files
- listed would also be copied to the A: drive.
- The "%1" becomes the complete filename with the period and the
- extension. If "%2" is used, it will become the first part of the filename,
- minus the period and the extension.
- If a "%3" is used, it will become the files extension, minus the first
- part of the filename and the period.
- A simple way to test this is to create a batch file named DITEST.BAT
- that contains the following commands:
-
- ECHO OFF
- ECHO This program tests how DI.COM passes filenames
- ECHO The full filename is %1
- ECHO The filename minus the extension is %2
- ECHO The extension of the filename is %3
- ECHO Press CTRL-BREAK to exit this test program
- PAUSE
-
- A batch file named DITEST.BAT may already be included with this file.
- Then enter the command "DI /X DITEST %1 %2 %3" to see DI's /X function in
- action.
-
- I have noticed that if I try to run the DI program from a batch file,
- I am unable to include the "=" sign. This is because the batch file will not
- pass the equal sign to the DI program as an argument.
-
-
- Page 6
-
- The DI program employs special redirection characters. If you wanted
- to append some text to the end of a number of files, you could use DI to
- accomplish the task. Hovever, if you entered the command,
- "DI \TEXT /X TYPE ADDITION.TXT >> \TEXT\%1" in order to have ADDITION.TXT
- appended to all of the files in the \TEXT directory , DOS would
- intercept the ">> \TEXT\%1", and execute the command
- "DI \TEXT /X TYPE ADDITION.TXT" with all of the output being appended to
- a file named "%1" in the \TEXT directory. In order to accomplish the task,
- you would have to enter "DI \TEXT /X TYPE ADDITION.TXT ]] \TEXT\%1".The DI
- program would then substitute a ">" for each "]" when it executed the command.
- In order to use the redirection or pipe characters you should substitute
- "]" for ">", "[" for "<", and "!" for "|".
- The "\X" option must always be the last option on the command line,
- since the DI program assumes that everything that follows is part of a
- command to be executed.
- The "/x" option can be used with any of the DI signs. The command
- after the "/X" will be executed ONCE FOR EACH FILENAME THAT IS PRINTED.
- Thus, if you enter a command like "DI \TEXT \WPDOC /xditest %1 %2 %3"
- the DI program will cause both directories to be printed side by side,
- and it will execute the command once for each of the files in BOTH
- directories. (Actually, the running of the DITEST batch file might mess up
- the way the two directories are printed, but it will never-the-less be run
- once for each filename.)
- This version of DI is being bundled with the DoTree Command Executor.
- When used together, the capabilities of DI's "/X" option can be greatly
- enhanced.
-
- ESTIMATING FILE SPACE
-
- If you have ever wanted to copy a number of small files to a floppy
- only to discover that they would not fit (even though there was more space
- on the floppy than the sum of the file's sizes,) then there is a feature of
- this program that you might find handy. You can add a "/#" option to the
- command, and it will tell you APPROXIMATELY how much disk space will be
- required for your files to fit on the different types of media.
-
- BACKGROUND INFORMATION
-
- The computer's operating system (DOS) divides any disk up into small
- sections known as CLUSTERS. When the computer is commanded to write a file
- onto the disk, the operating system assigns as many of these clusters as
- are necessary to store the file. If there are only a few bytes in a file,
- the operating system will assign only one cluster for that file's storage.
- The operating system will not attempt to have two files sharing the same
- cluster. Each file gets its own cluster or clusters. Clusters can vary in
- size from a low of 512 bytes (for 1.2 and 1.44 Meg floppies) to a high of
- several KiloBytes for some hard drives. The 360K and 720K floppies have
- cluster sizes of 1024 bytes. You can now see how a number of very small
- files (each requiring at least one cluster) can take up much more disk
- space than they would seem to need.
-
- MORE BACKGROUND INFORMATION
-
- You probably noticed that I said that the "/#" option would find out
- APPROXIMATELY how much space was needed to store the files. The reason that
- I used the word "approximately" is not because I mistrust my math. I used
- the word approximately because there is a factor that prevents our being
- able to know exactly how many clusters will be needed to store a given
- number of files. That factor is the directory listings.
-
- Page 7
-
- The information that you see when you type DIR (or preferably DI) is
- stored in a special file that the computer takes care of. The operating
- system won't let us edit these files in the same way we edit text files.
- Access to these files is restricted in order to keep us from messing up
- our disk's storage system. With the exception of the root directory, the
- size of a directory file is determined by the number of clusters needed
- to store its data. Each file listing and each subdirectory listing in a
- directory takes up 32 bytes. As a directory grows in size, it may require
- additional clusters to store its data. The additional clusters that are
- added to a directory decrease the amount of free space on a drive. That is
- what makes knowing the storage requirements for a number of files difficult.
-
- The root directory is a horse of a different color. The root directory
- on any given drive is of fixed length. The operating system cannot add
- clusters to the end of the root directory when it fills up. Once the root
- directory is full, an attempt to add more files or subdirectories results
- in an error. The number of files or subdirectories that will fit on the
- root directories of the various types of floppies is as follows:
-
-
- 360K - 112 entries
-
- 720K - 112 entries
-
- 1.2 Meg - 224 entries
-
- 1.44 Meg - 224 entries
-
-
- If you are going to copy the files to the root directory of a floppy,
- and there is room in the root for the files, then the numbers given with the
- "/#" option will be exact rather than approximate.
-
- ESTIMATING HARD DRIVE SPACE
-
- The "/#" numbers for the hard drive are determined as follows. The
- DI program checks to see if there is a hard drive installed. If there is,
- it examines the C: drive to determine the cluster size. If no hard drive is
- found, the program assumes a default hard drive cluster size of 2048 bytes.
-
- A LITTLE TRICK
-
- Suppose you entered a DI command without the "/#" and then realized
- that you also wanted to know the storage requirements. At the final pause,
- when the screen says "Press any key to exit...," press either the "#" or the
- "3", and the storage data will print as if you had entered the "/#" option.
-
- PAUSE OPTION
-
- The program's default is to pause after each screenful, except when
- the "/X" option has been chosen. When the "/X" option is selected, the
- program will NOT pause after each screenful. Entering the "/P" option
- will toggle the pause mode. It will prevent pauses in normal mode, and
- allow them if the "/X" option is chosen.
-
-
-
- Page 8
-
-
- TECHNICAL LAYOUT OF A .DIR FILE
-
- The layout of a normal (not text) mode .DIR file is as follows:
-
- bytes # Field description
-
- 0 - 11 FILENAME AND EXTENSION in ASCIIZ format with zeros to
- fill out leftover space
- 12 ZERO (always) that's a binary zero, not the character "0"
-
- 13 ATTRIBUTE BYTE
-
- 14 & 15 TIME (16 bit word with L.S.Byte first)
-
- 16 & 17 DATE (16 bit word with L.S.Byte first)
-
- 18 - 21 FILE SIZE (32 bit double word with L.S.Byte first)
-
-
- The layout of a text mode .DIR file is as follows:
-
- bytes # Field description
-
- 0 - 11 FILENAME AND EXTENSION the same as the normal mode above
- except that all zeros are replaced with spaces
-
- 12 SPACE (always) This byte of the first record is what the
- program checks to determine if it is a text mode file
-
- 13 - 19 SPACES (the character " ")
-
- 20 & 21 CARRIAGE RETURN AND LINE FEED (0dh and 0ah)
-
-
-
- TERMS AND CONDITIONS
-
-
- This program is CHARWARE!
-
-
- That is to say you may freely distribute this program with its
- accompanying document file (DI.DOC). You are encouraged to use this
- program as many times as you like to determine its usefulness.
- Once you are hooked, please send at least $10 to the following CHARITY.
-
-
- DI SOFTWARE REGISTRATION, DEPT. 0612
- THE HUNGER PROJECT
- 1388 Sutter St.
- San Francisco, CA 94109
-
-
- The proceeds of this software will go towards putting an end
- to hunger by the end of the century.
-
- No restriction will be placed on how this software may be distributed
- or who may use it, with the following exceptions:
-
- 1) This program (DI.COM) must be distributed with this documentation file
- (DI.DOC).
-
- 2) Neither of these two files may be edited or altered in any way that
- will effect their performance or meaning (Archiving excepted.)
-
- 3) If any software company wishes to include these two files in their
- software package, they must make it clear that the purchase of their
- software package does not release their customers from their obligation
- to register the DI program with The Hunger Project (unless the software
- company sends The Hunger Project $10 for each software package sold.)
- Please contact the author before including this program in any package
- you may be offering (nothing formal, I'm just curious.)
-
- 4) Any and all use of this software is subject to the WARRANTY AND
- LIABILITY DISCLAIMER.
-
- No attempt will be made to enforce the registration of this software
- package, and no action will be taken against anyone who is found to be
- using an unregistered copy of this program. Enforcement of the requirement
- that the user register their software will instead be a function of each
- user's conscience.
-
- And now for the legal stuff...
-
- WARRANTY AND LIABILITY DISCLAIMER
-
- The DI.COM program and its accompanying documentation are provided
- "AS IS" and are without warranty of any kind, either express or implied,
- as to fitness for any particular purpose. We do not warrant that any
- functions contained in the DI.COM program will meet your requirements or
- that your use of this program will be free of errors.
- This author and The Hunger Project shall not be liable for consequential,
- special, indirect, or other similar claims or damages including loss of
- profits or any other commercial damages arising from the use and/or
- distribution of this program or any of the files or documentation associated
- with it. Have a nice day.
-
- Page 9
-
-
- VERSION INFORMATION
-
- Version 1.0 The original version.
-
- Version 1.1 Comes bundled with the DoTree Command Executor.
- This version will not pause before exiting when it is
- run with the "/X" option, thereby allowing DoTree to
- work with DI without interruptions.
-
-
- ACKNOWLEDGEMENTS
-
- I would like to thank Rick Carrara whose moral support and thorough
- and painstaking scrutiny as a beta tester and advisor have helped make
- this software as useful and error-free as it is.
- I especially want to thank my wife Hindey without whose patience,
- support, and understanding this program would never have been written,
- (and without whose help as a proofreader you might never have figured
- out how to use this program.)
-
-
- QUESTIONS AND COMMENTS
-
- Users with questions or comments can send them to me
- (the author) at the following address:
-
- Preston Moser
- 807 Bennett Ave. #6
- Medford, OR 97504
-
-
- Or send me E-Mail on Compuserve, at 72621,1377
-
-
-
- Don't forget to register your software!
-
-
-
- You CAN make a difference!
-