Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch file to delete files with .bak extension

Tags:

In batch, I want to delete all files *.bak in various folders on disk c:\.
Can anyone help me?

ex.:

all c: del *.bak /s /a 

Thank you.

like image 917
Sweeper Avatar asked Apr 04 '14 19:04

Sweeper


People also ask

How do I delete a .BAK file?

In which case, you just do a search from the root directory, then order the bak files by date and delete all the ones older than 2 weeks. folder on my C-drive called (you guessed it) "Bakfiles". From there it's very simply to delete older files no longer needed. I use the MOVEBAK command.

How do I force delete a batch file?

Force delete using Windows With the command prompt open, enter del /f filename , where filename is the name of the file or files (you can specify multiple files using commas) you want to delete.


1 Answers

It can be a single command.

del /s /q /f c:\*.bak 
like image 127
foxidrive Avatar answered Oct 04 '22 00:10

foxidrive