Recursively Delete a Specific File Type from all Subfolders

Print View Mobile View

In this post I will show you couple of ways to bulk delete files with a specific extension in a folder and all its subfolders. This can be useful, for instance, if a virus infected your PC and automatically created .exe files in all folders, or if you want to delete automatically created .log or .tmp files. You won’t mind manually deleting if there are only a few files/folders, but what if there are hundreds of such unwanted files stored in as many folders? We can avoid the pain by using a simple Command Prompt command. Or if you aren’t comfortable with command line usage, scroll a bit further down for a software to achieve the same result.

Delete Files of Specific Extension using Command Prompt

Open Command Prompt by entering CMD in the Run dialog or by searching for it in the Start menu/screen.
Switch to the folder in which you want to perform the deletion operation. Once there, type in the following command (assuming to delete .tmp files):

DEL /S /Q *.TMP

This command will delete all the ‘Tmp’ files from the folder you are in, and all of the subfolders.

Here,
/S : Instructs to delete files from all subdirectories.
/Q : Deletes files quietly, i.e., without prompts.

You can also specify multiple file extensions in the command like this:

DEL /S /Q *.EXE *.TMP

To see more information on the command, type in DEL /? in the prompt window.
Delete Command Prompt

Delete Files of Specific Extension with Folder Cleaner

Folder Cleaner is a free software which allows users to delete files from multiple folders on your computer and from network devices in batches. It functions using file filters – this lets you include and exclude files based on its extension.
Folder Cleaner

Before starting the deletion process, the program allow you to pre-analyze the chosen search criteria. So, if any unwanted result is found, you can correct it before actually executing the task. Another useful option is the possibility to delete files to Recycle Bin, which is not possible in the command line method.

Overall, the program is simple and quite easy to use. Just specify what you want to do and where, and you’re good to go. It’s portable, so you can even carry it on your portable drive.

Folder Cleaner works on both 32-bit and 64-bit editions of Windows 8, Windows 7, Windows Vista, and Windows XP.

Download: Folder Cleaner