I discovered ForFiles last night and was/remain astonished to learn that it has been around since Vista (which I think I did not experience).
Forfiles is a useful windows command to select a set of files and then run a command on each of the files.
I was looking for a batch/command-line process to delete unwanted files and while I can do a pretty good job with the DOS FOR command I wanted a means of visiting each SubDirectiry in a neater manner.
Here is my early draft, which works for now.
Code: Select all
TITLE FFile.bat - runs the ForFiles command under Win10 ::6:09 PM 9/10/2020 first version :: Parameter 1 is the mask e.g. eras*.* OR ~*.* OR *.BAK set pause=pause set mask=%1 if "%1"=="" set mask=ERAS*.* echo %mask% %pause% :: forfiles /p t:\ /m %mask% /s /c "cmd /c del @file" forfiles /p t:\ /m %mask% /s %pause% REM end of FFile.bat
P.S. I am in the habit of saving transient files with names like "Eraseme.txt" and "eraseme2.txt"