Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sweep.exe replacement? 2

Status
Not open for further replies.

paoconnell

Programmer
Jun 11, 2002
41
0
0
US
Wayyyy back in the mists of time (early 90s) DOS and Windows 3.x ran in 16 bit space. In those days, there was a program called sweep.exe that would start in the current directory and execute a DOS command (with arguments) on that directory and all of its subdirectory tree, e.g.

sweep del *.bak

would remove all .bak files from the current directory and subdirectories, and their subdirectories ad infinitum.

Sweep was useful for removing .bak, .obj, and other temporary files during a development process, as well as (for instance) compiling all source modules in a tree.

Sweep.exe still exists, but hasn't been maintained since the early 90s, and doesn't recognize long filenames, which were first implemented in Win95 and WinNT.

The question: Is there a functional equivalent to sweep that runs from the cmd box, and will recognize long filenames?


Pat O'Connell
Visualize Whirled Peas
 
Hi,
Del ( with appropriate options) can work that way:

Code:
--------------------------------------
c:\transfers\CIDData>help del
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
                Wildcards may be used to delete multiple files. If a
                directory is specified, all files within the directory
                will be deleted.

  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcar
  /A            Selects files to delete based on attributes
  attributes    R  Read-only files            S  System files
                H  Hidden files               A  Files ready for archivi
                -  Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.


Hope it helps..
[profile]
 
Well, that's a del feature I didn't know about--helpful!

Recursing del is a part of the solution, but the rest of the functionality would help too. Anyone else?

Pat O'Connell
Visualize Whirled Peas
 
you could always use the search function in explorer.
Do your search for *.bak and delete the whole mess.
 
FORFILES.exe (Resource Kit)

Batch process multiple files. CMD can call any valid DOS command or even a batch file.

syntax
FORFILES [-pPath] [-s] [-dDate] [-mMask] [-cCommand]

key
-pPath : Path to search default=current folder

-s : Recurse into sub-folders

-dDate : This can be
+DDMMYY to select files newer than a given date
(filedate >=DDMMYY) or
-DDMMYY to select files older than a given date
(filedate <=DDMMYY) or
+DD to select files newer than DD days ago or
-DD to select files older than DD days ago

-mMask : Search mask (wildcards allowed) default=*.*
-cCommand : Command to execute on each file. default="CMD /C Echo @FILE"

-v : Verbose report

The following variables can be used in the -cCommand (must be upper case)

@FILE,
@FNAME_WITHOUT_EXT,
@EXT,
@PATH,
@RELPATH,

@ISDIR,
@FSIZE,
@FDATE,
@FTIME

To ECHO Hex characters in the Command use: 0xHH

Examples:

To find every text file on the C: drive
FORFILES -pC:\ -s -m*.TXT -c"CMD /C Echo @FILE is a text file"
To show the path of every HTML file on the C: drive
FORFILES -pC:\ -s -m*.HTML -c"CMD /C Echo @RELPATH is the location of @FILE"
List every folder on the C: drive
FORFILES -pC:\ -s -m*. -c"CMD /C if @ISDIR==TRUE echo @FILE is a folder"
For every file on the C: drive list the file extension in double quotes
FORFILES -pc:\ -s -m*.* -c"CMD /c echo extension of @FILE is 0x22@EXT0x22"

Direct download:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top