home *** CD-ROM | disk | FTP | other *** search
/ PC Format 7 / Disk7.iso / SPDMAP / SM.DOC < prev   
Text File  |  1991-12-20  |  17KB  |  343 lines

  1.                   Space Map
  2.               Disk Space Mapping Program
  3.                  Version 1.0
  4.  
  5.  
  6.                   Ben Smith
  7.                110 S. Gardenia
  8.               Celeste, TX  75423
  9.  
  10. SCENARIO 1:  You're a network administrator.  One morning, to your
  11. horror, you discover that one of your users has eaten all but 500K of
  12. the space on the system volume!  Quick, which user is the culprit?
  13.  
  14. SCENARIO 2:  You're installing that new Windows application that takes
  15. only about fifteen meg of disk.  You have six.    Quick, which directory
  16. can you zap and free up enough space?
  17.  
  18. SCENARIO 3:  You're about to do a backup, and would like list of
  19. EVERY file on your disk to compare to your backup copy should the
  20. worst happen. Quick, how do you get it?
  21.  
  22. With SPACE MAP, it's easy!  Space Map is the utility you need to
  23. answer simple questions like:
  24.  
  25.   How big is that application, with all its directories?
  26.  
  27.   What can I clean off my disk to free up space?
  28.  
  29.   Hey!    Where'd all my disk go?!
  30.  
  31. BUT WHY?  Because no utility I use could do this!  I own Lotus
  32. Magellan, PC Tools 7.1 and several other general purpose utility
  33. packages...NONE of them could tell me how much space was in use in a
  34. single directory and all of its child directories!  Even the several
  35. dozen shareware offerings couldn't do this simple chore (although I'd
  36. be happy to hear from anyone who knows of a product that does this).
  37.  
  38. LATE NOTE - 12/20/91  I just downloaded a copy of CAT Systems' DIGGER
  39. utility.  It does much the same job as this program, although it has a
  40. different "flavor."  DIGGER (and the other parts of the Lion
  41. Utilities) is a good program which presents another take on fixing
  42. this problem.
  43.  
  44. DISTRIBUTION:  Space Map is being distributed as freeware.  You are
  45. free to use Space Map on as many computers as you like, for as long as
  46. you like.  You may give copies away to friends, customers, business
  47. associates, or anyone else.  If you are a shareware distributor, you
  48. may include Space Map in your collection, so long as your disks sell
  49. for less than $5.00 each, and you make it clear to your customers
  50. that they are buying the physical diskette, and that the program
  51. itself is free.
  52.  
  53. You may not, however, sell the Space Map program itself.  The program,
  54. this document file, and any other files which may be distributed in
  55. the Space Map archive file are copyrighted material (c) 1991 Ben
  56. Smith.    Permission to copy is granted so long as the above conditions
  57. are met.
  58.  
  59. DISCLAIMER:  While I have taken every reasonable precaution to ensure
  60. that Space Map is safe and effective when used as directed, because of
  61. the diversity of software and hardware in common use I cannot be
  62. responsible for any actual or consequential damages caused by this
  63. program to your computer or the data stored in it.  You use this
  64. program strictly at your own risk.  By running the program, you
  65. indicate your assent to this limitation of liability.
  66.  
  67. WHAT'S IN THE ARCHIVE?
  68.  
  69. The archive (or disk, if you obtained the program from a shareware
  70. distributor) contains the following files:
  71.  
  72.      SM.COM    The Space Map program
  73.      SM.DOC    The documentation file you're reading now
  74.      READ.ME   Last minute notes, release updates
  75.  
  76. HOW TO USE IT:    Copy the SM.COM file to some directory on your PATH
  77. (if you're not sure what a PATH is, ask someone).  On my computer, I
  78. have a UTIL directory that includes all of my one-program utilities
  79. (like LIST and PKZIP).    The syntax of the command to invoke Space Map
  80. is:
  81.  
  82.      SM [pathname] [/T] [/F] [/Dnn]
  83.  
  84. All parameters to the SM command are optional.    When the program is
  85. invoked, it will always descend through EVERY subdirectory under
  86. [pathname].  As it goes, it will add up the sizes of all of the files
  87. it finds.  As it backs out of each directory, it can display the total
  88. of the sizes of all files in the directories it's found along the way.
  89.  
  90. Three parameters are used to tell Space Map how to display the
  91. results:
  92.  
  93.      /T   -    Print the time and date of each file and directory
  94.      /F   -    Display every file as well as directories
  95.      /Dnn -    Display only the first nn directory levels
  96.  
  97. The same information can be obtained by typing SM/H or SM/?.  You will
  98. then see the following summary screen:
  99.  
  100. ╔════════════════════════════════════════════════════════════════════╗
  101. ║ Space Map        Version 1.0                      ║
  102. ║ Copyright (c) 1991, Ben Smith                      ║
  103. ║                                     ║
  104. ║ Usage: SM [directory spec] [/T] [/F] [/Dnn]                 ║
  105. ║     /T - Display file time and date instead of allocated space  ║
  106. ║     /F - Display files in each directory                 ║
  107. ║     /Dnn - Display only nn levels of directory depth         ║
  108. ║     /? or /H - Display this help text                 ║
  109. ╚════════════════════════════════════════════════════════════════════╝
  110.  
  111. Just by typing SM in your current directory, you'll see a display
  112. something like this:
  113.  
  114. ╔══════════════════════════════════════════════════════════════════╗
  115. ║ Space map of C:\TEMP                           ║
  116. ║ This directory:.......136,577 bytes.......159,744 allocated.       ║
  117. ║ ├─OVERVIEW:.............767,171 bytes.......774,144 allocated.   ║
  118. ║ │ ├─EMPTY:.....................no files.               ║
  119. ║ │ ├─NONEMPTY:..............63,275 bytes........65,536 allocated. ║
  120. ║ ├─OVERVIEW..............830,446 bytes.......839,680 allocated.   ║
  121. ║ ├─EMPTY:.....................no files.               ║
  122. ║ │ ├─NOTRLY:....................no files.               ║
  123. ║ ├─EMPTY......................no files.               ║
  124. ║ Directory total:......967,023 bytes.......999,424 allocated.       ║
  125. ╚══════════════════════════════════════════════════════════════════╝
  126.  
  127. The first line tells you what directory is being mapped.  In this
  128. case, it is the TEMP directory in the root of the C: disk drive.  The
  129. second line tells you how much space is being taken up by files that
  130. are in this SPECIFIC (C:\TEMP) directory; that is, files in
  131. subdirectories are not included.  The first number (in this case,
  132. 136,577) is the total of all bytes reported as being used by DOS.  The
  133. second number (in this case, 159,744) is the amount of space which has
  134. ACTUALLY been allocated to these files by DOS.    This may require some
  135. explaination:
  136.  
  137. A disk generally consists of one or more platters, which are round
  138. aluminum disks on which ferric oxide has been coated.  Each platter is
  139. served by (generally) two heads, one on the top and one on the bottom.
  140. Each surface is divided into circular tracks, and each track is
  141. divided into arc-shaped sectors which contain (generally) 512 bytes
  142. each. The tracks have to be divided into sectors because the head
  143. can't actually turn on and off instantly, and if you tried to change,
  144. say, byte 2,345 on a track, you'd probably wipe out a few hundred
  145. bytes on each side of the one you were trying to change.  To
  146. prevent this, the disk manufacturers make you read an entire
  147. sector, make the change to the sector in memory, and the write the
  148. entire sector back.  Each sector is surrounded by an "inter-record
  149. gap" which is a safe place to turn on and off the current to the write
  150. head.  The space taken up by these gaps is not inconsequential; in
  151. fact, it may consume ten to fifteen percent of the disk.
  152. Consequently, it's good to make the sectors as large as possible (that
  153. way, less good disk surface is taken up by the inter-record gaps).
  154.  
  155. The problem is that the sector becomes the smallest unit of storage
  156. that you can address!  A typical disk has 512 bytes per sector, and
  157. this means that if you have a one-byte file, it is stored on a 512
  158. byte sector, with the other 511 bytes unused!  Worse, DOS usually
  159. treats eight physical disk sectors as the smallest allocatable unit of
  160. storage (called a cluster), which means that that one-byte file
  161. actually wastes 4,095 bytes!  And some disk compression programs
  162. encourage even larger clusters!!
  163.  
  164. Well, that second number tells you how much DOS has allocated for your
  165. files.    The difference between that number and the first one tells you
  166. how much disk space the file system is "wasting" because of the
  167. granularity of the file system itself.    Unfortunately, there's not
  168. much you can do about this...it's a problem built into the file
  169. system.  But if you want to see the problem in all its glory, look at
  170. a directory full of Windows icons...each 766 byte icon gets allocated
  171. 4,096 bytes!
  172.  
  173. The third line tells you the space used in the first subdirectory of
  174. C:\TEMP; that is, the OVERVIEW directory (C:\TEMP\OVERVIEW) in the
  175. same format used in the previous line.    The fourth line tells you that
  176. the first subdirectory of OVERVIEW (C:\TEMP\OVERVIEW\EMPTY) has no
  177. files (and so is appropriately named).    The fifth line gives the space
  178. used by the second subdirectory under OVERVIEW
  179. (C:\TEMP\OVERVIEW\NONEMPTY).
  180.  
  181. Now, the sixth line is the interesting one.  It gives the space used
  182. by the OVERVIEW subdirectory AND ALL DIRECTORIES BENEATH IT.  Add it
  183. up yourself, and see.
  184.  
  185. The next subdirectory of C:\TEMP is named EMPTY, but it really isn't:
  186. It contains the directory named NOTRLY.  NOTRLY has no files or
  187. subdirectories, so the third line indicates that there are no bytes in
  188. files in the directory.
  189.  
  190. Well, the program lies slightly here.  Each subdirectory is really a
  191. file, and subject to the same constraints as a regular file.
  192. Specifically, every subdirectory uses at least one cluster of storage
  193. that isn't accounted for by this program.
  194.  
  195. The last line summarizes the storage used by the directory C:\TEMP and
  196. ALL off its subdirectories.  The same technique is used to scan any
  197. directory on your disk.  For instance, to see how much storage Windows
  198. is using, you'd type SM "C:\WINDOWS".
  199.  
  200. USING THE SWITCHES:  Other than the switches used to obtain help (/H
  201. and /?) Space Map has three operational switches.  Using any switches
  202. other than those supported won't hurt anything, but they won't help,
  203. either.
  204.  
  205.     /F - This flag causes the program to print the name and space used
  206.     by EVERY file as it is encountered.  For example, using the /F
  207.     flag on the directory shown above might give the following
  208.     display:
  209.  
  210.  ╔═══════════════════════════════════════════════════════════════════╗
  211.  ║ Space map of C:\TEMP                          ║
  212.  ║ ├─T.BAK..................25,566 bytes........28,672 allocated.    ║
  213.  ║ ├─T.ASM..................25,937 bytes........28,672 allocated.    ║
  214.  ║ ├─T.LST..................47,400 bytes........49,152 allocated.    ║
  215.  ║ ├─T.OBJ...................3,195 bytes.........4,096 allocated.    ║
  216.  ║ ├─T.COM...................3,310 bytes.........4,096 allocated.    ║
  217.  ║ ├─CURRENT.STS...............292 bytes.........4,096 allocated.    ║
  218.  ║ ├─LOOK.ASC..................734 bytes.........4,096 allocated.    ║
  219.  ║ ├─THEDRAW.PCK...............650 bytes.........4,096 allocated.    ║
  220.  ║ ├─TCTSR.ASM..............26,803 bytes........28,672 allocated.    ║
  221.  ║ ├─SM.DOC.................12,880 bytes........16,384 allocated.    ║
  222.  ║ ├─T.INC.....................504 bytes.........4,096 allocated.    ║
  223.  ║ ├─T.HLP.....................319 bytes.........4,096 allocated.    ║
  224.  ║ ├─Files total:..........147,590 bytes.......180,224 allocated.    ║
  225.  ║ ├─OVERVIEW:                                 ║
  226.  ║ │ ├─BUZZ.TXT..................248 bytes.........4,096 allocated.  ║
  227.  ║ │ ├─WHISPER.EXE............63,275 bytes........65,536 allocated.  ║
  228.  ║ │ ├─AGANZLK.TXT...........703,648 bytes.......704,512 allocated.  ║
  229.  ║ │ ├─Files total:..........767,171 bytes.......774,144 allocated.  ║
  230.  ║ │ ├─EMPTY:                                 ║
  231.  ║ │ ├─NONEMPTY:                             ║
  232.  ║ │ │ ├─WHISPER.EXE............63,275 bytes........65,536 allocated.║
  233.  ║ │ │ ├─Files total:...........63,275 bytes........65,536 allocated.║
  234.  ║ ├─OVERVIEW..............830,446 bytes.......839,680 allocated.    ║
  235.  ║ ├─EMPTY:                                 ║
  236.  ║ │ ├─NOTRLY:                                 ║
  237.  ║ ├─EMPTY......................no files.                 ║
  238.  ║ Directory total:......978,036 bytes.....1,019,904 allocated.      ║
  239.  ╚═══════════════════════════════════════════════════════════════════╝
  240.  
  241.     (Before someone writes and tells me the file totals are different
  242.     here than in the previous example, don't bother.  This is my
  243.     actual working directory!  From the time one display was captured
  244.     to the time another was captured, some files grew and others were
  245.     added.)
  246.  
  247.     /T - This flag causes the program to display the time and date
  248.     instead of the allocated space for both files and directories.
  249.     Allocated space will still be shown for the main directory and its
  250.     summary line.  It may be combined with the /F flag.  The result of
  251.     applying the /T flag to the above sample directory is shown below:
  252.  
  253.  ╔══════════════════════════════════════════════════════════════════╗
  254.  ║ Space map of C:\TEMP                         ║
  255.  ║ This directory:.......152,460 bytes.......184,320 allocated.     ║
  256.  ║ ├─OVERVIEW:.............767,171 bytes........91/12/18 13:58:42   ║
  257.  ║ │ ├─EMPTY:.....................no files........91/12/18 17:43:50 ║
  258.  ║ │ ├─NONEMPTY:..............63,275 bytes........91/12/19 13:10:00 ║
  259.  ║ ├─OVERVIEW..............830,446 bytes........91/12/18 13:58:42   ║
  260.  ║ ├─EMPTY:.....................no files........91/12/18 17:43:28   ║
  261.  ║ │ ├─NOTRLY:....................no files........91/12/19 15:45:52 ║
  262.  ║ ├─EMPTY......................no files........91/12/18 17:43:28   ║
  263.  ║ Directory total:......982,906 bytes.....1,024,000 allocated.     ║
  264.  ╚══════════════════════════════════════════════════════════════════╝
  265.  
  266.     /Dnn - The /D flag causes the program to stop displaying
  267.     directories after the nnth level.  Using /D0 will cause the
  268.     program to just print the intro line and a summary line for the
  269.     entire directory structure.  Here is what our sample directory
  270.     would look like with a /D1 option:
  271.  
  272.  ╔════════════════════════════════════════════════════════════════╗
  273.  ║ Space map of C:\TEMP                       ║
  274.  ║ This directory:.......136,577 bytes.......159,744 allocated.   ║
  275.  ║ ├─OVERVIEW:.............830,446 bytes.......839,680 allocated. ║
  276.  ║ ├─EMPTY:.....................no files.              ║
  277.  ║ Directory total:......967,023 bytes.......999,424 allocated.   ║
  278.  ╚════════════════════════════════════════════════════════════════╝
  279.  
  280.     Use the /Dnn option to limit the amount of information given in
  281.     the output.  You can see much of a disk in just a few lines by
  282.     providing the appropriate /D switch.  It may be combined with the
  283.     files (/F) switch and the time/date (/T) switch.
  284.  
  285. REDIRECTION:  This program uses only DOS calls to send information to
  286. the screen.  Consequently, the output of the program can be redirected
  287. to any DOS device, including a file, a printer, or a serial device.
  288. In fact, sending the information to a printer is a good way to keep
  289. permanent record of what's on your disk.  To direct the output of this
  290. program to a printer, just type:
  291.  
  292.        SM >prn
  293.  
  294. PERFORMANCE:  The program traverses the entire 80MB disk on an 286/8
  295. in about fifteen seconds.  It scans a 200MB drive on a 386/33 in about
  296. twelve seconds.
  297.  
  298. NETWORK USE:  Space Map works very nicely on a network, although it
  299. may behave in a way you don't expect.  First, if you're using a Novell
  300. network and have drives MAP ROOTed to a server subdirectory, Space Map
  301. will see through that.    For example, if you have a file server named
  302. SERVER1, a volume mounted on that server named SYS, and a subdirectory
  303. on SYS named \USER\BOB mapped to drive G:, and you ask Space Map to
  304. display drive G's contents, the top line will report that you are
  305. viewing "\\SERVER1\SYS\USER\BOB".  This is because Space Map uses
  306. DOS's True Name function, and this is the true name to DOS of the
  307. network drive.    Space Map has been tested extensively only on Novell
  308. networks, but should work on any network supported by DOS.
  309.  
  310. OTHER INFORMATION:  If you need to communicate with the author, he is:
  311.  
  312.     Ben Smith
  313.     110 S. Gardenia
  314.     Celeste, TX  75423
  315.  
  316. My CompuServe ID is 70143,2023, but I only check mail about twice a
  317. week.
  318.  
  319. DEVELOPMENT INFORMATION:  The program was developed using Microsoft's
  320. Macro Assembler version 6.0 over a couple of days in December, 1991.
  321. It is coded in 100% assembly language. The program was tested
  322. extensively on two different computers:  A Northgate 386/33 with a
  323. 200MB hard drive connected to a Novell NetWare 2.15C server via SMC
  324. 10baseT media; and an AMT-286 8MHz AT clone.  Both machines run MS-DOS
  325. version 5.
  326.  
  327. The program uses only standard DOS calls, with the exception of
  328. Interrupt 21 function 60, Expand Path Name String.  This function
  329. works in all versions of DOS since version 3, and is reported to work
  330. in the OS/2 1.x compatibility box.  I would appreciate any reports of
  331. incompatibility.
  332.  
  333. ENHANCEMENTS:  I've thought of several things I could do to this
  334. program to improve it, but none that could be done quickly or easily.
  335. If you think of something I've left out of a program of this scope,
  336. drop me a line.  I can't promise I'll implement any suggestion (the
  337. program IS free, after all) but I'll consider it and respond.
  338.  
  339. SOURCE CODE AVAILABILITY:  Source code can be made available on a paid
  340. license basis.    Contact me by mail or CompuServe for other details.
  341. The price of a source code license would depend greatly on the use to
  342. which the code is to be put, but I'm very reasonable!
  343.