home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / dircount.zip / README.DCT < prev   
Text File  |  1994-06-01  |  4KB  |  110 lines

  1. DIRCOUNT - retrieve size of a directory, including all sub-directories.
  2.  
  3.  
  4. How to Use
  5. ----------
  6.  
  7. From an OS/2 command prompt, enter the command in the following format:
  8.  
  9.     DIRCOUNT [d:] directory-name [\subdirectory] [\subdirectory]...
  10.  
  11.   Drive letter is optional, unless you're in a sub-directory which is not a parent
  12. to the directory for which you're retrieving the size.
  13.  
  14. See the section "Examples" for... well... examples.
  15.  
  16.  
  17. What it does
  18. ------------
  19.  
  20. DIRCOUNT simply rolls through a directory, adding up the size of each file
  21. it encounters. If the file happens to be a sub-directory, THAT sub-directory
  22. is then switched to, and all files are read and added into the total. If
  23. any sub-directories are encountered in a sub-directory, THOSE are read
  24. and added in to the total. When the directory and all sub-directories have
  25. been read, the size is reported.
  26.  
  27. I just re-read that last paragraph, and have the feeling I overused the
  28. word "sub-directory."
  29.  
  30. Only one function in the entire program reads directories and adds up the 
  31. file sizes. It is called recursively every time another sub-directory is
  32. encountered. I'm taking advantage of the C-language characteristic that does
  33. not preserve variables when a function is entered, even if called recursively.
  34. My mom always said I was clever (then again, she also thinks I'm cool...).
  35.  
  36.  
  37. Examples:
  38. --------
  39.  
  40.  From the C: root directory, retrieve the size of the OS2 directory:
  41.  
  42.        "dircount os2 <cr>"  or  "dircount c:\os2 <cr>"
  43.  
  44.  
  45.  From the root directory, retrieve the size of the OS2\MDOS directory:
  46.  
  47.        "dircount os2\mdos <cr>"  or  "dircount c:\os2\mdos <cr>"
  48.  
  49.  
  50.  From the OS2\MDOS directory, retrieve the size of the full OS2 directory:
  51.  
  52.        "dircount c:\os2 <cr>"  
  53.    If entered without the "c:\", you will get a message stating the directory
  54. cannot be found.
  55.  
  56.  
  57. By the way, the command "dircount c:\" won't work for some reason (the reason
  58. most likely is that there is a bug), but, what the hey, if you want the entire
  59. directory you can do a CHKDSK.
  60.  
  61.  
  62. Why I wrote it
  63. --------------
  64.  
  65. 2 reasons: 1) When I needed the size of a full directory, I got sick of
  66. having to change to all directories, using the "dir" command and adding 
  67. everything up from there; and 2) I recently started learning C language, and
  68. I wanted to bang out a program as part of the learning process.
  69.  
  70.  
  71. Other Stuff
  72. -----------
  73.  
  74. I placed this in the public domain because, mainly, it's a dinky little
  75. utility with no hope of sale value. But I've downloaded my share of freeware
  76. from BBS's, plus a lot of the programmers had the decency to include source
  77. code (from which I've been able to learn), so I don't mind giving back.
  78.  
  79. The code is there for you. Use it, learn from it. I'll check my mail infrequently
  80. if you have any questions.
  81.  
  82.  
  83. This utility will run in OS/2 only. I've tested it on various machines in
  84. my own installation, and it's worked on everything from the IBM ValuePoint to
  85. an IBM PS/2 57/76/80, as well as compatibles. Even on machines with 386 and
  86. 486 chips (but you're probably too young to remember those).
  87.  
  88. This was compiled using WATCOM C/C++32 vsn 9.5. The compiler performs various
  89. optimization routines, so the executable usually runs pretty quick and clean.
  90.  
  91.  
  92.  
  93. Legal Stuff
  94. -----------
  95.  
  96. This program is distributed as is, WITHOUT ANY WARRANTY. Use it at your 
  97. own risk (which, I believe, is minimal).
  98.  
  99. This is free software, it has been placed in the public domain. The code
  100. included may be used in another program or modified, but if you do this,
  101. do me a favor and take my name off it. The ZIP file containing the source, 
  102. executable and this readme may be distributed free of charge to anyone, anywhere,
  103. any time, and any other "any's" I forgot.
  104.  
  105. By using this you agree not to hold me responsible for any problems encountered
  106. while using DIRCOUNT, whether in executable format or in using the source code
  107. for other programs.
  108.  
  109. Steve Warshaw
  110.