3

I want to delete all files in a folder that start with a certain string, for example "File_EXC" and that are .zip files.

7
  1. CD to the correct path.
  2. DEL FILE_EXC*.ZIP
  3. Press Enter
1

Would it be satisfactory to have it run at shutdown, instead of taking up process cycles by looping every 10 minutes? If so:

Open a Command Prompt, type gpedit.msc and click OK. Expand Computer Configuration | Windows Settings | select Scripts (Startup/Shutdown) .
Double-click Shutdown in the right side pane.
Click Add, and put your batch file's filename and path in there.
Test it by shutting down and restarting, then looking for the files which should have been deleted.

If not, create a second batch file here named LOOPY.BAT which contains:

REM LOOPY.BAT
:loop
command /c batchfilename.bat
timeout /t timeToWaitBetweenCallsInSeconds /nobreak
goto :loop
  • 4
    This answer doesn't describe how to delete files matching a certain pattern. And the question doesn't mention anything about running in a loop or at shutdown. – Kodos Johnson Jun 28 at 21:33
  • I've asked the OP to modify the question, as he posted another question which dovetails into the first, but what was rejected for lack of clarity. – K7AAY Jun 28 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.