Dec 062017
 
Applies any DOS Com to Entire HD (not TSR).
File SWEEP.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
Applies any DOS Com to Entire HD (not TSR).
File Name File Size Zip Size Zip Type
SWEEP.COM 592 540 deflated
SWEEP.DOC 6144 2360 deflated

Download File SWEEP.ZIP Here

Contents of the SWEEP.DOC file


Cleaning Up With SWEEP
(PC Magazine Vol 4 No 23 November 12, 1985 by Charles Petzold)

Most commands and programs work only with a single subdirectory.
Used together with SWEEP, these commands can operate over the multiple
subdirectories on your hard disk.

If you'd like a complete listing, subdirectory by subdirectory,
of all the files on your hard disk, there are several ways to do it.
You could issue the TREE command with the /F parameter, or the CHKDSK
command with the /V parameter. Each of these procedures provides only
the filenames without the size, date and time information you would
get with the DIR command. To get the full story, you would normally
have to change subdirectories manually, issuing the DIR command for
each one. On the other hand, if you enter: SWEEP DIR you'll get the
complete DIR command output for every subdirectory on your hard disk.
Want the list printed out? Try: SWEEP DIR > PRN.

Take another example. Strewn all over your hard disk are lots of
WordStar .BAK files, and you'd like to get rid of all of them in one
shot. Use: SWEEP DEL *.BAK.

Or perhaps you would like to copy all your .ASM files, now spread
over various subdirectories, into a single ASMFILE subdirectory. The
command is: SWEEP COPY *.ASM \ ASMFILE. SWEEP will also work with
.COM and .EXE programs. The LOCATE.COM program (PC Magazine Vol 4
No 10) does a text-pattern search through all files in a single
subdirectory. While you can supplement LOCATE with a separate PATH.DAT
file for other directory searches, it's easier to LOCATE every instance
of the phrase "IBM PC" on your hard disk with: SWEEP LOCATE IBM PC.

Another problem. Somewhere on your hard disk is an important file
called RESUME. You need to find a new job quickly but you have no idea
where your RESUME file is. It's simple to find it with SWEEP. Just
issue the command: SWEEP IF EXIST RESUME PAUSE and you'll get the
message "Strike a key when ready . . ." when SWEEP lands on the
subdirectory where RESUME resides. Although the IF construction is
normally used in batch files, it can also be used on the command line
by itself, so it is a legitimate parameter for SWEEP.

Indeed, you can also execute a whole batch file as a SWEEP
parameter. For instance, suppose you create a file called CLEAN.BAT
consisting of the lines:
DEL *.BAK
DEL *.TMP
DEL *.OBJ
If you now issue the command: SWEEP CLEAN all the .BAK, .TMP and .OBJ
files will be deleted.

Suppose you want to create a file that contains a list of all the
subdirectories on your hard disk. Just set up a batch file called
DIRLIST, with the single line: CHDIR >> \ DIRLIST. Then execute:
SWEEP DIRLIST. (The reason for putting the CHDIR >> \ DIRLIST line in
a batch file is that if you had simply executed:
SEEEP CHDIR >> \ DIRLIST from the command line, the SWEEP message as
well as each directory would have been written to the DIRLIST file.)

The syntax for SWEEP is simply, SWEEP command, where command is
any DOS internal or external command, or any .COM, .EXE or .BAT file
you would normally be able to enter following the DOS prompt. The
command following the word SWEEP will be executed over all nested
subdirectories of the default drive, beginning with the current
directory. If the current directory is the root directory, SWEEP will
do your whole disk. Otherwise, it will only sweep across a subset of
your hard disk.

Before the specified command is executed in each subdirectory,
the ">>> SWEEP >>> directory" will be displayed, indicating the
directory in which the command will be executed. The cursor will pause
briefly after showing the directory name, allowing you to break out of
SWEEP by quickly pressing Ctrl-Break or Ctrl-C before the command
begins.

If the parameter you give to SWEEP is not in the default directory
then there must be a path to the subdirectory containing the .COM, .EXE
or .BAT file you want SWEEP to use. This path can be set with the PATH
command. (Actually, if you're using DOS 3.0 and above, you can simply
preface the .COM or .EXE program name with the full directory name of
its location.)

What's important to note here is that SWEEP takes no parameter
other than the command to be executed. Thus, 1) your default drive
must be the one you want SWEP to work over; 2) your current directory
on that drive must be that in which you want SWEEP to begin; and, 3)
the command must be on a path that allows it to work on the default
drive and subdirectory.

For instance, suppose you have two hard disks, C: and D:, and
your current drive is C:. If you want a DIR listing of all your .ASM
files on drive D:, you cannot issue the command: SWEEP DIR D:*.ASM
from the C> prompt. That would only do a DIR on the current directory
of D: over and over again, each time with a new subdirectory of drive
C:, which you do not even want swept. Simply change your drive to D:
first, so you can issue your command from the D> prompt instead.

Of course, for many command and programs, using SWEEP will not
make any sense. For instance, there would be no reason to run the
command: SWEEP CHKDSK. And you should know enough NOT to try:
SWEEP DEL *.* unless you want to wipe out every file you've got.

The key to SWEEP's operation is the ability of DOS 2.0 and above
to load a secondary version of COMMAND.COM together with a command to
be executed. When SWEEP loads this version of COMMAND.COM, it simply
passes to it the SWEEP parameter. Thus, SWEEP loads a secondary
version of COMMAND.COM for every nexted subdirectory on the default
drive, beginning with the current directory. Each time COMMAND.COM
returns control to SWEEP, SWEEP changes the directory and loads
COMMAND.COM again.



 December 6, 2017  Add comments

Leave a Reply