0

DEL "J:\testing.TMP"

The above CMD command will delete a single file: testing.TMP.
How can I delete all files that have the same extension .TMP?

  • 4
    del j:\*.tmp - use wildcards – Appleoddity Aug 24 '18 at 13:05
  • DEL C:\Users\Username\AppData\Local\Google\Chrome\User Data\*.TMP cannot delete the .TMP files there. Why? – Matthew Wai Aug 24 '18 at 13:52
  • 2
    @MatthewWai because the path has spaces, so it thinks Data*.TMP is a new parameter. Use quotes to fix the issue: del "c:\users\username\appdata\local\google\chrome\user data\*.tmp" or alternatively, first browse to the folder, and then simply execute del *.tmp – LPChip Aug 24 '18 at 13:55
2

The easiest way is to first navigate to the folder in question.

For example:

cd /d j:\MyFolder

or

j:
cd MyFolder

and then execute the delete command:

del *.tmp

You can also do it all in one command:

del j:\MyFolder\*.tmp

If your folder contains spaces, you need to put the entire parameter in quotes.

Example:

cd /d "C:\Program Files"

or

del "F:\My Folder With Spaces\*.tmp"

It is good to know, that you can autocomplete foldernames by pressing Tab one or more times.

So if you type cd /d C:\Progr and you press tab at this point, it will change to the following 2 commands depending on how many times you press tab:

cd /d "C:\Program Files"
cd /d "C:\Program Files (x86)"

The same also works with del or any other command. Tab will autocomplete foldernames first, then continue to autocomplete filenames if it finds any.

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.