home *** CD-ROM | disk | FTP | other *** search
-
- RM.COM by Mark Adler Pasadena, CA 1988,1989.
-
-
- RM is an extended delete command. It can delete all the files in a
- directory and its subdirectories, etc. and remove all the directories.
- Alternatively, it can delete all the files in any directories that match
- the specified pattern. Since RM is a more powerful delete command, it
- can be that much more dangerous. So the following warning is in order:
-
- WARNING: RM IS A VERY DESTRUCTIVE COMMAND. It will NOT ask for
- verification of a particularily destructive argument like the DOS DEL
- command does. What you ask it is what it does. BE CAREFUL.
-
- Normally, RM acts like the DEL command, deleting any files that match
- the pattern, except that it does not verify the argument *.*---it just
- does it. For example:
-
- rm *.bak
-
- will delete all the *.bak files in the current directory. The command:
-
- rm *.*
-
- will delete all the files in the current directory without asking first.
-
- RM can also delete the contents of subdirectories and then remove the
- subdirectories. The option for this is "/S". For example:
-
- rm/s \tex
-
- will delete all the files and subdirectories contained in \tex and
- finally remove the directory \tex. The command:
-
- rm/s \tex\*.*
-
- will do the same thing, but not remove the directory tex, just
- everything in it.
-
- Alternatively, RM can delete any files that match the pattern in all
- subdirectories. The option for this is "/F":
-
- rm/f \*.bak
-
- will delete all *.bak files on the current drive, no matter where they
- are. No subdirectories will be removed.
-
- If you think that's dangerous, RM can also remove hidden, system, or
- read-only files if asked to. The options are "/H", "/Y", and "/R".
- For example:
-
- rm/shyr \*.* DON'T EVEN THINK OF TYPING THIS COMMAND.
-
- will remove every single file and directory on the current drive,
- including the system---leaving only the drive label, a lot of empty
- space, and a user in a state of panic.
-
- RM can take multiple arguments, processing each in turn. For example:
-
- rm *.obj *.lst *.map
-
- will delete all the files specified.
-
- RM does have one option that makes it a little less dangerous; "/P".
- This option causes RM to prompt you for every file or directory it tries
- to get rid of. For example:
-
- rm/p *.*
-
- might ask you:
-
- Delete file test.c (y/n)? _
-
- or
-
- Remove directory \tmp (y/n)? _
-
- In either case, you must respond with either an upper or lower case "Y"
- or "N". Any other response is ignored.
-
- When it is done, RM will tell you how many files it deleted and how many
- directories it removed. It might say, for example:
-
- 13 files deleted
-
- or
-
- 129 files deleted and 4 directories removed
-
- If RM is, for some reason, unable to delete a file or remove a
- directory, it will say:
-
- Could not delete file test.c
-
- or
-
- Could not remove directory \tmp - part of current path
-
- or
-
- Could not remove directory \tmp - unable to empty it
-
- It should not be possible to get the first error. The second error
- occurs when the directory RM tried to remove is part of the current path
- for that drive. DOS does not allow pulling the rug out from under your
- feet by removing a directory you are in. The remedy is to change out of
- the directory you wish to remove and repeating the RM command.
-
- The third error can happen when RM tries to remove a directory with
- read-only, hidden, or system files in it, and no options were specified
- to allow RM to remove those. The remedy is to repeat the RM command
- with the necessary options to delete the files desired.
-
- RM takes options that are preceded by a slash (/). The command line is
- read from left to right, processing options and file/path names as they
- appear. However, options that are appended to a file/path name take
- effect before that name is processed. For example, this command would
- do the same thing as "rm/p *.c":
-
- rm *.c/p
-
- But the command "rm *.c /p" (notice the extra space before the /p) would
- not do the same thing. In this case, RM notices the "dangling" option
- before it does anything and simply ignores the entire command for
- safety, printing:
-
- Dangling option---entire command ignored
-
- Since there are options to change the defaults along a command line,
- there are options to change them back for processing the next thing
- on the command line. All the options are listed here:
-
- /P - Prompt for each deletion or removal.
- /Q - Quiet---don't prompt (default).
- /S - Remove matching subdirectories and all of their contents.
- /N - Ignore subdirectories (default).
- /H - Remove hidden files.
- /V - Visible---ignore hidden files (default).
- /Y - Remove system files.
- /T - Typical---ignore system files (default).
- /R - Remove read-only files!
- /W - Only delete writable files (default).
- /F - Remove all files that match pattern, and no subdirs.
- /A - Remove all files in subdirectories, period (default).
- /? - Display version number and list of options.
-
- For example, the command:
-
- rm /p *.lst /q *.obj
-
- will ask before deleting each file that matches *.lst, and then delete
- all the files that match *.obj without asking.
-
- Options can be combined with or without additional slashes. For
- example, these commands do the same thing:
-
- rm *.lst/pr
- rm/p/r *.lst
- rm /p /r *.lst
- rm /p *.lst/r
-
- Once again---BE CAREFUL WITH THIS COMMAND. Thanks to Kurt Schmidt for
- suggesting that RM be changed to notice a dangling option.
-
-
- Version history -
-
- 1.0 4 Jun 1988 First public version
- 1.1 4 Nov 1988 Make rm as fast as del (use FCB delete)
- 1.2 18 Nov 1988 Fixed for Turbo C 2.0 (label needs statement)
- 1.3 3 Feb 1989 Display files and directories in lower case
- 1.4 21 Oct 1989 Catch dangling options and ignore command
-
-
- Feel free to send any problems with or comments on RM to:
-
- Mark Adler
- P.O. Box 60998
- Pasadena, CA 91116
-