bat file to delete .bak files in sub folders

G

Guest

I want to write a batch file to detlete *.bak files from the master folder
and all its sub folders
C:\master\sub1\etc
how would I do this?
 
G

Guest

the del command has a comfirm for multiple file deletion. You can pipe an
enter with echo.
....
cd C:\master
echo y | del *.bak
cd C:\master\sub1\
echo y | del *.bak
....
 
A

Ayush

Replied to [kirk]s message :
I want to write a batch file to detlete *.bak files from the master folder
and all its sub folders
C:\master\sub1\etc
how would I do this?

del "C:\master\" /q /a /s



Good Luck, Ayush.
 
A

Ayush

Replied to [kirk]s message :
I want to write a batch file to detlete *.bak files from the master folder
and all its sub folders
C:\master\sub1\etc
how would I do this?

del "C:\master\*.bak" /q /a /s



Good Luck, Ayush.
 
J

John John

The /s switch will cause the command to run through the current folder
and all its sub folders.

del /s c:\master\*.bak

the /q switch will "quiet" the command, you will not see its actions or
verbose asking for confirmation.

del /s /q c:\master\*.bak

Use the @Echo off if you want to see none of the commands:

The batch file contains 2 simple lines and a return line at the end:

===============================================
@echo off
del /s /q c:\master\*.bak

===============================================

John
 
O

Opinicus

Mark L. Ferguson said:
the del command has a comfirm for multiple file deletion. You can pipe an
enter with echo.
cd C:\master
echo y | del *.bak
cd C:\master\sub1\
echo y | del *.bak

Isn't it wonderful to see DOS lurking within the very bowels of whatever
incarnation of Windows we may have to deal with?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top