home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / s / sprdpr20.zip / RM.DOC < prev    next >
Text File  |  1989-10-21  |  6KB  |  181 lines

  1.  
  2. RM.COM by Mark Adler  Pasadena, CA  1988,1989.
  3.  
  4.  
  5. RM is an extended delete command.  It can delete all the files in a
  6. directory and its subdirectories, etc. and remove all the directories.
  7. Alternatively, it can delete all the files in any directories that match
  8. the specified pattern.  Since RM is a more powerful delete command, it
  9. can be that much more dangerous.  So the following warning is in order:
  10.  
  11. WARNING:  RM IS A VERY DESTRUCTIVE COMMAND.  It will NOT ask for
  12. verification of a particularily destructive argument like the DOS DEL
  13. command does.  What you ask it is what it does.  BE CAREFUL.
  14.  
  15. Normally, RM acts like the DEL command, deleting any files that match
  16. the pattern, except that it does not verify the argument *.*---it just
  17. does it.  For example:
  18.  
  19.      rm *.bak
  20.  
  21. will delete all the *.bak files in the current directory.  The command:
  22.  
  23.      rm *.*
  24.  
  25. will delete all the files in the current directory without asking first.
  26.  
  27. RM can also delete the contents of subdirectories and then remove the
  28. subdirectories.  The option for this is "/S".  For example:
  29.  
  30.      rm/s \tex
  31.  
  32. will delete all the files and subdirectories contained in \tex and
  33. finally remove the directory \tex.  The command:
  34.  
  35.      rm/s \tex\*.*
  36.  
  37. will do the same thing, but not remove the directory tex, just
  38. everything in it.
  39.  
  40. Alternatively, RM can delete any files that match the pattern in all
  41. subdirectories.  The option for this is "/F":
  42.  
  43.      rm/f \*.bak
  44.  
  45. will delete all *.bak files on the current drive, no matter where they
  46. are.  No subdirectories will be removed.
  47.  
  48. If you think that's dangerous, RM can also remove hidden, system, or
  49. read-only files if asked to.  The options are "/H", "/Y", and "/R".
  50. For example:
  51.  
  52.      rm/shyr \*.*               DON'T EVEN THINK OF TYPING THIS COMMAND.
  53.  
  54. will remove every single file and directory on the current drive,
  55. including the system---leaving only the drive label, a lot of empty
  56. space, and a user in a state of panic.
  57.  
  58. RM can take multiple arguments, processing each in turn.  For example:
  59.  
  60.      rm *.obj *.lst *.map
  61.  
  62. will delete all the files specified.
  63.  
  64. RM does have one option that makes it a little less dangerous; "/P".
  65. This option causes RM to prompt you for every file or directory it tries
  66. to get rid of.  For example:
  67.  
  68.      rm/p *.*
  69.  
  70. might ask you:
  71.  
  72.      Delete file test.c (y/n)? _
  73.  
  74. or
  75.  
  76.      Remove directory \tmp (y/n)? _
  77.  
  78. In either case, you must respond with either an upper or lower case "Y"
  79. or "N".  Any other response is ignored.
  80.  
  81. When it is done, RM will tell you how many files it deleted and how many
  82. directories it removed.  It might say, for example:
  83.  
  84.      13 files deleted
  85.  
  86. or
  87.  
  88.      129 files deleted and 4 directories removed
  89.  
  90. If RM is, for some reason, unable to delete a file or remove a
  91. directory, it will say:
  92.  
  93.      Could not delete file test.c
  94.  
  95. or
  96.  
  97.      Could not remove directory \tmp - part of current path
  98.  
  99. or
  100.  
  101.      Could not remove directory \tmp - unable to empty it
  102.  
  103. It should not be possible to get the first error.  The second error
  104. occurs when the directory RM tried to remove is part of the current path
  105. for that drive.  DOS does not allow pulling the rug out from under your
  106. feet by removing a directory you are in.  The remedy is to change out of
  107. the directory you wish to remove and repeating the RM command.
  108.  
  109. The third error can happen when RM tries to remove a directory with
  110. read-only, hidden, or system files in it, and no options were specified
  111. to allow RM to remove those.  The remedy is to repeat the RM command
  112. with the necessary options to delete the files desired.
  113.  
  114. RM takes options that are preceded by a slash (/).  The command line is
  115. read from left to right, processing options and file/path names as they
  116. appear.  However, options that are appended to a file/path name take
  117. effect before that name is processed.  For example, this command would
  118. do the same thing as "rm/p *.c":
  119.  
  120.      rm *.c/p
  121.  
  122. But the command "rm *.c /p" (notice the extra space before the /p) would
  123. not do the same thing.  In this case, RM notices the "dangling" option
  124. before it does anything and simply ignores the entire command for
  125. safety, printing:
  126.  
  127.     Dangling option---entire command ignored
  128.  
  129. Since there are options to change the defaults along a command line,
  130. there are options to change them back for processing the next thing
  131. on the command line.  All the options are listed here:
  132.  
  133.      /P  - Prompt for each deletion or removal.
  134.      /Q  - Quiet---don't prompt (default).
  135.      /S  - Remove matching subdirectories and all of their contents.
  136.      /N  - Ignore subdirectories (default).
  137.      /H  - Remove hidden files.
  138.      /V  - Visible---ignore hidden files (default).
  139.      /Y  - Remove system files.
  140.      /T  - Typical---ignore system files (default).
  141.      /R  - Remove read-only files!
  142.      /W  - Only delete writable files (default).
  143.      /F  - Remove all files that match pattern, and no subdirs.
  144.      /A  - Remove all files in subdirectories, period (default).
  145.      /?  - Display version number and list of options.
  146.  
  147. For example, the command:
  148.  
  149.      rm /p *.lst /q *.obj
  150.  
  151. will ask before deleting each file that matches *.lst, and then delete
  152. all the files that match *.obj without asking.
  153.  
  154. Options can be combined with or without additional slashes.  For
  155. example, these commands do the same thing:
  156.  
  157.      rm *.lst/pr
  158.      rm/p/r *.lst
  159.      rm /p /r *.lst
  160.      rm /p *.lst/r
  161.  
  162. Once again---BE CAREFUL WITH THIS COMMAND.  Thanks to Kurt Schmidt for
  163. suggesting that RM be changed to notice a dangling option.
  164.  
  165.  
  166. Version history -
  167.  
  168. 1.0      4 Jun 1988     First public version
  169. 1.1      4 Nov 1988     Make rm as fast as del (use FCB delete)
  170. 1.2     18 Nov 1988     Fixed for Turbo C 2.0 (label needs statement)
  171. 1.3      3 Feb 1989     Display files and directories in lower case
  172. 1.4     21 Oct 1989     Catch dangling options and ignore command
  173.  
  174.  
  175. Feel free to send any problems with or comments on RM to:
  176.  
  177.         Mark Adler
  178.         P.O. Box 60998
  179.         Pasadena, CA  91116
  180.  
  181.