home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / COMPRESS / AUTOLZ.ZIP / DI.DOC < prev    next >
Encoding:
Text File  |  1990-08-05  |  22.7 KB  |  530 lines

  1.  
  2.        ╔════════════════════════════════════════╗
  3.        ║                        ║
  4.        ║                        ║
  5.        ║    THE DIRECTORY DICER  (version 1.1)  ║
  6.        ║                        ║
  7.        ║                        ║
  8.        ╚════════════════════════════════════════╝
  9.  
  10.  
  11.            Copyright 1990 by A. Preston Moser
  12.  
  13.  
  14.      This program is being bundled with DoTree, a command executor.
  15. While DoTree is a public domain program, DI.COM is not. DI.COM is a
  16. Charware program with proceeds going to The Hunger Project. See TERMS
  17. AND CONDITIONS below.
  18.  
  19.  
  20.              SETUP
  21.  
  22.      To set up the Directory Dicer, simply place the DI.COM file in
  23. one of the directories in the computer's PATH. (That is, one of
  24. the directories named in the path command in the autoexec.bat file.)
  25.      Putting this program in the first directory listed in your path
  26. command will increase the access speed.
  27.      In my CONFIG.SYS file I set up a RAMDRIVE. I then have my AUTOEXEC.BAT
  28. file copy my most often used utility programs into the Ramdrive, and I
  29. make the Ramdrive the first directory in my path command. This speeds
  30. things up and lessens the strain on the hard drive.
  31.  
  32.              GETTING STARTED
  33.  
  34.      At any time when you would normally type DIR to get a listing of
  35. the files in a directory, instead, type DI. (That's one less letter
  36. you'll have to type). You will find that the directory is listed much
  37. the same way that it is with DIR with a few notable exceptions:
  38.  
  39.   1) All subdirectories will be listed first, and in alphabetical order.
  40.  
  41.   2) All of the files will be listed (also in alphabetical order).
  42.  
  43.   3) The display pauses after each screenful instead of scrolling off
  44.      the screen before it can be read.
  45.  
  46.   4) Pressing ESC will cause the program to exit to DOS immediately (unless
  47.      it is executing a command from the DOS shell, but more on that later.)
  48.  
  49.   5) The list of filenames will include commas in the file size number
  50.      for greater readability.
  51.  
  52.   6) Information about whether the file is Read-only, Archived, System, or
  53.      Hidden is given at the right side of the listing.
  54.  
  55.   7) After all of the files have been listed, the program gives the sum of
  56.      the file sizes in addition to how many files were found and how much
  57.      free space remains.
  58.  
  59.      So far, so good, but wait! There's much more!
  60.  
  61.  
  62.              SORTING OPTIONS
  63.  
  64.      By default, all files will be listed alphabetically by filename.
  65. You can tell the program to list the files sorted by Size, Date and time,
  66. Extension, or you can have the files Unsorted.    This is done by adding
  67. a "/S", "/D", "/E", or "/U" (respectively) after the command. Adding
  68. "/R" either by itself, or with one of the other sort options, will Reverse
  69. the order in which the files are displayed.
  70.  
  71.             DOUBLE DIRECTORY DISPLAY
  72.  
  73.      If you give the program the name of two directories (separated by
  74. a space,) it will print both directories side by side for easy comparison.
  75. Thus, entering "DI . \/d/r" will cause the current directory and the root
  76. directory to be displayed side by side, sorted by Date and time, with the
  77. newest files listed at the top. (Note that there must be a space between
  78. the two directory names, but there doesn`t have to be a space between the
  79. second directory name and the options.)
  80.  
  81.                             Page 3
  82.              USING SIGNS
  83.  
  84.      The DI program can be used to compare two directories and to list
  85. the files in the first directory for which there is a matching filename
  86. in the second directory. If, for instance, there were two directories
  87. containing the following files:
  88.  
  89. Directory #1 - C:\TEXT
  90.  
  91.      LETR11.TXT     3,421 bytes    Jan. 14, 1988   1:30p   .A..
  92.  
  93.      RESP01.TXT     5,123 bytes    Jan. 27, 1988  11:15a   .A..
  94.  
  95.      NOTE_2.DOC    23,332 bytes    Sep. 15, 1989   4:20p   RA..
  96.  
  97.    PROG_NOT.DOC     1,462 bytes    Mar. 27, 1987   2:15p   ....
  98.  
  99.     MYNOTES.TXT     7,878 bytes    Feb.  8, 1990   9:21a   .A..
  100.  
  101.        READ.ME     2,731 bytes    Apr. 22, 1986  12:01a   .A..
  102.  
  103. Directory #2 - C:\WPDOC
  104.  
  105.      LETR22.TXT    17,899 bytes    Aug.  7, 1988  12:01a   .A..
  106.  
  107.        READ.ME    47,592 bytes    July  4, 1987  10:36a   .A..
  108.  
  109.      LETR11.TXT     3,421 bytes    Jan. 14  1988   1:30p   .A..
  110.  
  111.      RESP01.TXT     8,432 bytes    Feb.  2, 1988   3:14p   .A..
  112.  
  113.    PROG_NOT.DOC     1,462 bytes    Mar. 27, 1987   2:15p   RA..
  114.  
  115.   ... And you were to enter the command "DI \TEXT = \WPDOC" while
  116. you were in the "C:\NOTES" directory, the following files would be listed:
  117.  
  118.      LETR11.TXT     3,421 bytes    Jan. 14, 1988   1:30p   .A..
  119.  
  120.    PROG_NOT.DOC     1,462 bytes    Mar. 27, 1987   2:15p   ....
  121.  
  122.        READ.ME     2,731 bytes    Apr. 22, 1986  12:01a   .A..
  123.  
  124.      RESP01.TXT     5,123 bytes    Jan. 27, 1988  11:15a   .A..
  125.  
  126.      As you can see, those files with the same name were listed (in
  127. alphabetical order). If you enter the command "DI \TEXT - \WPDOC",
  128. (read that "TEXT directory MINUS the WPDOC directory") then the
  129. files listed would be those files in the first directory for which
  130. there were no matching filenames in the second directory. In our
  131. example the results would be:
  132.  
  133.     MYNOTES.TXT     7,878 bytes    Feb.  8, 1990   9:21a   .A..
  134.  
  135.      NOTE_2.DOC    23,332 bytes    Sep. 15, 1989   4:20p   RA..
  136.  
  137.      Notice that LETR22.TXT would not be printed even though it is
  138. in the second directory but not the first. Only files from the first
  139. directory will be printed.
  140.  
  141.                             Page 4
  142.  
  143.      There are two options that work with the "=" sign. They are "/M" and
  144. "/N". If you enter the command "DI \TEXT = \WPDOC /m", you will get those
  145. files whose names, dates, times, and sizes all Match exactly. For our
  146. example you would get:
  147.  
  148.      LETR11.TXT     3,421 bytes    Jan. 14  1988   1:30p   .A..
  149.  
  150.    PROG_NOT.DOC     1,462 bytes    Mar. 27, 1987   2:15p   ....
  151.  
  152.  
  153. Thus, the "/M" option (M for Match) will only pass those files that APPEAR
  154. to be identical. The DI program does not compare the data in the files,
  155. it only compares their directory listings. Furthermore, the file's attributes
  156. (Read only, Archive, System, and Hidden) are not compared.
  157.      Entering the command "DI \TEXT = \WPDOC /N" causes the following files
  158. to be named:
  159.  
  160.      RESP01.TXT     5,123 bytes    Jan. 27, 1988  11:15a   .A..
  161.  
  162.     READ.ME     2,731 bytes    Apr. 22, 1986  12:01a   .A..
  163.  
  164.      That is, those files with matching filenames whose date, time, OR size
  165. do Not match (/N is for Not match) will be listed.
  166.  
  167.      It should be noted that two files that are created a few seconds apart,
  168. but within the same minute will not have the same date and time number even
  169. though they appear the same when listed with DI or DIR. For, while the DIR
  170. command in DOS or the DI program show the time in hours and minutes, the
  171. actual number that is stored includes seconds in two second increments.
  172.  
  173.  
  174.              THE ".DIR" FILE
  175.  
  176.      So far we have discussed two of the three possible signs ("=" & "-".)
  177. There is one more sign that has not been mentioned, namely the "}", or
  178. right brace. To use this sign with the example above we might enter the
  179. command "DI \TEXT } TEXTFILS". To do so would create a file named
  180. TEXTFILS.DIR which would contain all of the directory information for each
  181. of the files in the C:\TEXT. The length of the file would be the number of
  182. files in the directory * 22. The file that was created could then be used
  183. as the second directory in subsequent DI commands. For instance, three weeks
  184. after creating the TEXTFILS.DIR file you could enter the command
  185. "DI \TEXT = TEXTFILS /n" and you would see a list of any files that had been
  186. changed in the last three weeks. (It would not, however, mention any files
  187. that had been deleted.) If you suspected that any files had been deleted,
  188. you could enter the command "DI \TEXT TEXTFILS" and you would see the files
  189. from the \TEXT directory and the TEXTFILS.DIR file displayed side by side.
  190.      There is another way of viewing the data that bears mentioning now.
  191. In our example above, if we had entered the command as "DI \TEXT TEXTFILS /M"
  192. then the files would have been listed side by side, but they would have
  193. been staggered according to the sort criterion, with files that had the
  194. same name (when sorting alphabetically) side by side.
  195.      In the first example, I mentioned that we were issuing the command
  196. from the C:\NOTES directory. If that were the case when we created the
  197. TEXTFILS.DIR file in the example above, then the TEXTFILS.DIR file would
  198. have been placed in the C:\NOTES directory, and we would have had to run
  199. the comparisons from the same directory, or made the command look like
  200. "DI \TEXT = \NOTES\TEXTFILS/n".
  201.  
  202.                             Page 5
  203.  
  204.      The ".DIR" files created by the DI program cannot easily be read by
  205. a normal text editor or word processor, because the file contains numbers
  206. that are in binary format instead of ASCII text format. Furthermore,
  207. the files do not contain carriage returns. Consequently, to a text editor
  208. or a word processor, all of the data will appear to be on one very long line.
  209. If you would like to be able to read the list of filenames, you can create
  210. the file using the command "DI \TEXT } TEXTFILS /T". The "/T" option
  211. (T for Text mode) causes all of the numerical data in the file being
  212. created to be replaced by spaces and a final carriage return. The resulting
  213. file will have the same length as the file created without the "/T" option,
  214. but you should have no trouble reading it with a text editor or the DOS TYPE
  215. command. The .DIR file in text format can still be used by the DI program,
  216. but the /M and /N features will no longer work.
  217.      If you wish to edit a text mode .DIR file, you should do so VERY
  218. CAREFULLY. In order for the file to still be usable by the DI program,
  219. the number of spaces after each filename must be maintained. Each line
  220. of the text mode .DIR file should contain the filename in upper case
  221. letters followed by spaces and a carriage return. The number of spaces
  222. added to the number of characters in the filename should equal 20.
  223.      The "}" sign can also be used to add more files on to the end of an
  224. existing .DIR file, however, the program will not check for duplication
  225. of filenames in the .DIR file.
  226.      Adding files to a .DIR file with the /T option will cause all of the
  227. files in the .DIR file to be converted to the text mode. Once a .DIR file
  228. has been created in text mode or converted to text mode, all files that
  229. are later added to that file will be added in text mode whether a /t
  230. option is given or not.
  231.  
  232.               THE EXECUTE OPTION
  233.  
  234.      Perhaps the most powerful function of the DI program is the "/X"
  235. option. An example of its use is "DI \TEXT = \WPDOC /XCOPY TEXT\%1 A:\".
  236. In this example, those files in the \TEXT directory that are also named
  237. in the \WPDOC directory will be printed. After each file is printed,
  238. the command "COPY TEXT\FILENAME.EXT A:\" will be executed with the name
  239. of each file in the place of the "%1". Therefore, all of those files
  240. listed would also be copied to the A: drive.
  241.      The "%1" becomes the complete filename with the period and the
  242. extension. If "%2" is used, it will become the first part of the filename,
  243. minus the period and the extension.
  244. If a "%3" is used, it will become the  files extension, minus the first
  245. part of the filename and the period.
  246.      A simple way to test this is to create a batch file named DITEST.BAT
  247. that contains the following commands:
  248.  
  249.        ECHO OFF
  250.        ECHO This program tests how DI.COM passes filenames
  251.        ECHO The full filename is %1
  252.        ECHO The filename minus the extension is %2
  253.        ECHO The extension of the filename is %3
  254.        ECHO Press CTRL-BREAK to exit this test program
  255.        PAUSE
  256.  
  257.      A batch file named DITEST.BAT may already be included with this file.
  258. Then enter the command "DI /X DITEST %1 %2 %3" to see DI's /X function in 
  259. action. 
  260.  
  261.      I have noticed that if I try to run the DI program from a batch file,
  262. I am unable to include the "=" sign. This is because the batch file will not
  263. pass the equal sign to the DI program as an argument.
  264.  
  265.  
  266.                             Page 6
  267.  
  268.      The DI program employs special redirection characters. If you wanted
  269. to append some text to the end of a number of files, you could use DI to
  270. accomplish the task. Hovever, if you entered the command,
  271. "DI \TEXT /X TYPE ADDITION.TXT >> \TEXT\%1" in order to have ADDITION.TXT
  272. appended to all of the files in the \TEXT directory , DOS would
  273. intercept the ">> \TEXT\%1", and execute the command
  274. "DI \TEXT /X TYPE ADDITION.TXT" with all of the output being appended to
  275. a file named "%1" in the \TEXT directory. In order to accomplish the task,
  276. you would have to enter "DI \TEXT /X TYPE ADDITION.TXT ]] \TEXT\%1".The DI
  277. program would then substitute a ">" for each "]" when it executed the command.
  278. In order to use the redirection or pipe characters you should substitute
  279. "]" for ">", "[" for "<", and "!" for "|". 
  280.      The "\X" option must always be the last option on the command line, 
  281. since the DI program assumes that everything that follows is part of a
  282. command to be executed.
  283.      The "/x" option can be used with any of the DI signs. The command
  284. after the "/X" will be executed ONCE FOR EACH FILENAME THAT IS PRINTED.
  285. Thus, if you enter a command like "DI \TEXT \WPDOC /xditest %1 %2 %3"
  286. the DI program will cause both directories to be printed side by side,
  287. and it will execute the command once for each of the files in BOTH
  288. directories. (Actually, the running of the DITEST batch file might mess up
  289. the way the two directories are printed, but it will never-the-less be run
  290. once for each filename.)
  291.      This version of DI is being bundled with the DoTree Command Executor.
  292. When used together, the capabilities of DI's "/X" option can be greatly
  293. enhanced.
  294.  
  295.             ESTIMATING FILE SPACE
  296.  
  297.      If you have ever wanted to copy a number of small files to a floppy
  298. only to discover that they would not fit (even though there was more space
  299. on the floppy than the sum of the file's sizes,) then there is a feature of
  300. this program that you might find handy.  You can add a "/#" option to the
  301. command, and it will tell you APPROXIMATELY how much disk space will be
  302. required for your files to fit on the different types of media.
  303.  
  304.             BACKGROUND INFORMATION
  305.  
  306.      The computer's operating system (DOS) divides any disk up into small
  307. sections known as CLUSTERS. When the computer is commanded to write a file
  308. onto the disk, the operating system  assigns as many of these clusters as
  309. are necessary to store the file. If there are only a few bytes in a file,
  310. the operating system will assign only one cluster for that file's storage.
  311. The operating system will not attempt to have two files sharing the same
  312. cluster. Each file gets its own cluster or clusters. Clusters can vary in
  313. size from a low of 512 bytes (for 1.2 and 1.44 Meg floppies) to a high of
  314. several KiloBytes for some hard drives. The 360K and 720K floppies have
  315. cluster sizes of 1024 bytes. You can now see how a number of very small
  316. files (each requiring at least one cluster) can take up much more disk
  317. space than they would seem to need.
  318.  
  319.           MORE BACKGROUND INFORMATION
  320.  
  321.      You probably noticed that I said that the "/#" option would find out
  322. APPROXIMATELY how much space was needed to store the files. The reason that
  323. I used the word "approximately" is not because I mistrust my math. I used
  324. the word approximately because there is a factor that prevents our being
  325. able to know exactly how many clusters will be needed to store a given
  326. number of files. That factor is the directory listings.
  327.  
  328.                             Page 7
  329.  
  330.      The information that you see when you type DIR (or preferably DI) is
  331. stored in a special file that the computer takes care of. The operating
  332. system won't let us edit these files in the same way we edit text files.
  333. Access to these files is restricted in order to keep us from messing up
  334. our disk's storage system. With the exception of the root directory, the
  335. size of a directory file is determined by the number of clusters needed
  336. to store its data. Each file listing and each subdirectory listing in a
  337. directory takes up 32 bytes. As a directory grows in size, it may require
  338. additional clusters to store its data. The additional clusters that are
  339. added to a directory decrease the amount of free space on a drive. That is
  340. what makes knowing the storage requirements for a number of files difficult.
  341.  
  342.      The root directory is a horse of a different color. The root directory
  343. on any given drive is of fixed length. The operating system cannot add
  344. clusters to the end of the root directory when it fills up. Once the root
  345. directory is full, an attempt to add more files or subdirectories results
  346. in an error. The number of files or subdirectories that will fit on the
  347. root directories of the various types of floppies is as follows:
  348.  
  349.  
  350.             360K    -   112 entries
  351.  
  352.             720K    -   112 entries
  353.  
  354.             1.2 Meg -   224 entries
  355.  
  356.             1.44 Meg -   224 entries
  357.  
  358.  
  359.      If you are going to copy the files to the root directory of a floppy,
  360. and there is room in the root for the files, then the numbers given with the
  361. "/#" option will be exact rather than approximate.
  362.  
  363.             ESTIMATING HARD DRIVE SPACE
  364.  
  365.      The "/#" numbers for the hard drive are determined as follows. The
  366. DI program checks to see if there is a hard drive installed. If there is,
  367. it examines the C: drive to determine the cluster size. If no hard drive is
  368. found, the program assumes a default hard drive cluster size of 2048 bytes.
  369.  
  370.              A LITTLE TRICK
  371.  
  372.      Suppose you entered a DI command  without the "/#" and then realized
  373. that you also wanted to know the storage requirements. At the final pause,
  374. when the screen says "Press any key to exit...," press either the "#" or the
  375. "3", and the storage data will print as if you had entered the "/#" option.
  376.  
  377.              PAUSE OPTION
  378.  
  379.      The program's default is to pause after each screenful, except when
  380. the "/X" option has been chosen. When the "/X" option is selected, the
  381. program will NOT pause after each screenful. Entering the "/P" option
  382. will toggle the pause mode. It will prevent pauses in normal mode, and
  383. allow them if the "/X" option is chosen.
  384.  
  385.  
  386.  
  387.                             Page 8
  388.  
  389.  
  390.           TECHNICAL LAYOUT OF A .DIR FILE
  391.  
  392.      The layout of a normal (not text) mode .DIR file is  as follows:
  393.  
  394.      bytes #   Field description
  395.  
  396.      0 - 11    FILENAME AND EXTENSION   in ASCIIZ format with zeros to
  397.                          fill out leftover space
  398.      12        ZERO  (always) that's a binary zero, not the character "0"
  399.  
  400.      13        ATTRIBUTE BYTE
  401.  
  402.      14 & 15   TIME  (16 bit word with L.S.Byte first)
  403.  
  404.      16 & 17   DATE  (16 bit word with L.S.Byte first)
  405.  
  406.      18 - 21   FILE SIZE  (32 bit double word with L.S.Byte first)
  407.  
  408.  
  409.      The layout of a text mode .DIR file is as follows:
  410.  
  411.      bytes #   Field description
  412.  
  413.      0 - 11    FILENAME AND EXTENSION  the same as the normal mode above
  414.                    except that all zeros are replaced with spaces
  415.  
  416.      12        SPACE (always) This byte of the first record is what the
  417.               program checks to determine if it is a text mode file
  418.  
  419.      13 - 19   SPACES  (the character " ")
  420.  
  421.      20 & 21   CARRIAGE RETURN AND LINE FEED  (0dh and 0ah)
  422.  
  423.  
  424.  
  425.             TERMS AND CONDITIONS
  426.  
  427.  
  428.      This program is  CHARWARE!
  429.  
  430.  
  431. That is to say you may freely distribute this program with its
  432. accompanying document file (DI.DOC). You are encouraged to use this
  433. program as many times as you like to determine its usefulness.
  434. Once you are hooked, please send at least $10 to the following CHARITY.
  435.  
  436.  
  437.         DI SOFTWARE REGISTRATION, DEPT. 0612
  438.         THE HUNGER PROJECT
  439.         1388 Sutter St.
  440.         San Francisco, CA  94109
  441.  
  442.  
  443. The proceeds of this software will go towards putting an end
  444. to hunger by the end of the century.
  445.  
  446.      No restriction will be placed on how this software may be distributed
  447. or who may use it, with the following exceptions:
  448.  
  449.   1) This program (DI.COM) must be distributed with this documentation file
  450.      (DI.DOC).
  451.  
  452.   2) Neither of these two files may be edited or altered in any way that
  453.      will effect their performance or meaning (Archiving excepted.)
  454.  
  455.   3) If any software company wishes to include these two files in their
  456.      software package, they must make it clear that the purchase of their
  457.      software package does not release their customers from their obligation
  458.      to register the DI program with The Hunger Project (unless the software
  459.      company sends The Hunger Project $10 for each software package sold.)
  460.      Please contact the author before including this program in any package
  461.      you may be offering (nothing formal, I'm just curious.)
  462.  
  463.   4) Any and all use of this software is subject to the WARRANTY AND
  464.      LIABILITY DISCLAIMER.
  465.  
  466.      No attempt will be made to enforce the registration of this software
  467. package, and no action will be taken against anyone who is found to be
  468. using an unregistered copy of this program. Enforcement of the requirement
  469. that the user register their software will instead be a function of each
  470. user's conscience.
  471.  
  472. And now for the legal stuff...
  473.  
  474.                 WARRANTY AND LIABILITY DISCLAIMER
  475.  
  476.      The DI.COM program and its accompanying documentation are provided
  477. "AS IS" and are without warranty of any kind, either express or implied,
  478. as to fitness for any particular purpose. We do not warrant that any
  479. functions contained in the DI.COM program will meet your requirements or
  480. that your use of this program will be free of errors.
  481.      This author and The Hunger Project shall not be liable for consequential,
  482. special, indirect, or other similar claims or damages including loss of
  483. profits or any other commercial damages arising from the use and/or
  484. distribution of this program or any of the files or documentation associated
  485. with it.  Have a nice day.
  486.  
  487.                             Page 9
  488.  
  489.  
  490.              VERSION INFORMATION
  491.  
  492. Version 1.0    The original version.
  493.  
  494. Version 1.1   Comes bundled with the DoTree Command Executor.
  495.            This version will not pause before exiting when it is
  496.            run with the "/X" option, thereby allowing DoTree to
  497.            work with DI without interruptions.
  498.  
  499.  
  500.              ACKNOWLEDGEMENTS
  501.  
  502.      I would like to thank Rick Carrara whose moral support and thorough
  503. and painstaking scrutiny as a beta tester and advisor have helped make
  504. this software as useful and error-free as it is.
  505.      I especially want to thank my wife Hindey without whose patience,
  506. support, and understanding this program would never have been written,
  507. (and without whose help as a proofreader you might never have figured
  508. out how to use this program.)
  509.  
  510.  
  511.               QUESTIONS AND COMMENTS
  512.  
  513.      Users with questions or comments can send them to me
  514. (the author) at the following address:
  515.  
  516.             Preston Moser
  517.             807 Bennett Ave. #6
  518.             Medford, OR 97504
  519.  
  520.  
  521.      Or send me E-Mail on Compuserve, at 72621,1377
  522.  
  523.  
  524.  
  525.      Don't forget to register your software!
  526.  
  527.  
  528.  
  529.      You CAN make a difference!
  530.