home *** CD-ROM | disk | FTP | other *** search
- CmdSweep.c
-
- Author: Bill DuPree (with thanks to Jeff Lydiatt for PatMatch.c)
- Language: Lattice C version 5.04
- Date: January 16, 1990
- Version: 1.00
-
- Usage: CmdSweep [options] <starting_directory> "Command"
-
- CmdSweep executes a given command in every subdirectory under the
- specified starting directory including the starting directory. It
- can also be used to execute the command for every matching file
- encountered in the directory tree. If the current directory is the
- desired starting directory, then it may be specified by coding the
- argument as "".
-
- The "Command" argument specifies a template for the command you wish
- to execute. A favorite application of mine is to check the contents
- of a diskette for viral infestations by using CmdSweep with the command
- template "kv *", i.e. the full entry on the command line is:
-
- CmdSweep df0: "kv *"
-
- The command template may contain the escape sequences %p and %f. These
- will be replaced with the current directory path and current file
- respectively, in command generation. If you need to use the % character
- in the command, then escape it with an additional % character.
-
- The "-A" option will force CmdSweep to process directories (and files)
- in alphabetical order. While this may cause a slight performance penalty,
- it is useful in that you have some indication of how much processing
- remains to be done by the visual inspection of the current directory
- and/or file name.
-
- The use of the "-F" (Files) option will cause CmdSweep to execute the
- command for every file it encounters in the directory tree. If coded
- as "-F=pattern" then the command is executed only for files matching
- the AmigaDOS pattern.
-
- Deferred execution may be had through the use of the "-S" (Script) option
- which will cause CmdSweep to generate an AmigaDOS script file. This
- option is coded as "-S=script_file_name" where script_file_name is the
- name of the file to receive the list of script commands. If coded as
- "-SE=script_file_name" then ECHO commands will be placed into the
- script to provide a visible progress report when executing the script.
-
- You may use the "-X=pattern" (eXclude) option to exclude from
- consideration all files that match the supplied AmigaDOS pattern.
-
- The "-H" (Here) option will inhibit the directory tree traversal causing
- CmdSweep to operate only in the supplied directory. None of its
- subdirectories will be entered.
-
- To compile and link:
-
- lc -b -r -v CmdSweep.c
- lc -b -r -v PatMatch.c
- blink lib:c.o,CmdSweep.o,PatMatch.o to CmdSweep lib lib:lc.lib SD SC ND
-
- Examples:
-
- (1) To browse every C source and header file on a diskette in drive df1:
-
- CmdSweep -f=#?.((c)|(h)) df1: "More %f"
-
- (2) To create a script file in RAM: to do the same as example one:
-
- CmdSweep -s=ram:Browse.Script -f=#?.((c)|(h)) df1: "More %f"
-
- (3) To delete all files ending in the ".bak" extension on dh0:
-
- CmdSweep -f=#?.bak dh0: "delete %f"
- or
- CmdSweep dh0: "delete #?.bak"
-
- (4) To rid a diskette in drive df1: from viruses using the public domain
- KV program:
-
- CmdSweep df1: "kv *"
- or
- CmdSweep df1: "kv %p/"
- or
- CmdSweep -f df1: "kv %p/%f"
-
- I'm sure that you will find many other uses.
-
- --------------------------------------------------------------------------
- DISCLAIMER:
-
- THIS PROGRAM AND ITS ASSOCIATED DOCUMENTATION ARE PROVIDED "AS IS"
- WITHOUT REPRESENTATION OR WARRANTY OF ANY KIND, EITHER EXPRESS OR
- IMPLIED, INCLUDING WITHOUT LIMITATION, ANY REPRESENTATIONS OR
- ENDORSEMENTS REGARDING THE USE OF, THE RESULTS OF, OR PERFORMANCE OF
- THE PROGRAM OR ITS ASSOCIATED DOCUMENTATION, ITS APPROPRIATENESS,
- ACCURACY, RELIABILTY, OR CURRENTNESS. THE ENTIRE RISK AS TO THE USE OF
- THIS PROGRAM OR ITS ASSOCIATED DOCUMENTATION IS ASSUMED BY THE USER.
-
- IN NO EVENT WILL BILL DUPREE, NOR ANY OTHER PARTY INVOLVED IN THE
- CREATION OR DISSEMINATION OF THIS PROGRAM AND ITS ASSOCIATED
- DOCUMENTATION, BE LIABLE FOR ANY DAMAGES, DIRECT, INDIRECT,
- INCIDENTAL OR CONSEQUENTIAL, RESULTING FROM ANY DEFECT IN THIS PROGRAM,
- EVEN IF ANY OF THE AFOREMENTIONED PARTIES HAS BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGES.
-
- THIS DISCLAIMER SHALL SUPERCEDE ANY VERBAL OR WRITTEN STATEMENT TO
- THE CONTRARY.
-
- Enough of the CYA stuff already. This program is hereby placed into the
- public domain. Please use it freely for whatever purposes you deem
- necessary. However, if you incorporate it into any wondrous creations
- of your own, give credit where credit is due, i.e. leave the names of
- the author(s) intact in the code. We all want our moments in the sun.
- It would probably also be wise to continue including the disclaimer given
- the state of affairs in our litigious society. If you feel compelled to
- contact me for any reason, or if you want to pass on constructive
- criticism, suggestions, ideas for new features, or monetary rewards
- (not necessary), or if you are a young, pretty, and single female Amiga
- enthusiast in the Chicagoland area (I'm single), you can contact me at:
-
- Bill DuPree
- 7449 W. Washington #402
- Forest Park, IL. 60130
-