Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all files with specific extension in folder?

Tags:

terminal

cmd

I am looking for command to delete all files with a specific extension in a given folder. Both, for windows and mac.

Thanks!

like image 309
uksz Avatar asked Mar 12 '16 11:03

uksz


People also ask

How do I delete all files with the same extension?

You can do this using the Windows GUI. Enter "*. wlx" in the search box in explorer. Then after the files have been found, select them all (CTRL-A) and then delete using the delete key or context menu.

How do you remove all recursive files from a directory?

To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r . Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command.


1 Answers

Delete all files with extension .tmp in current folder:

On Windows:

del *.tmp 

On Mac:

rm -rf ./*.tmp 


Delete all files with extension .tmp in current folder Recursively (including sub-folders):

On Windows:

del /s *.tmp 

On Mac:

find . -name '*.tmp' -delete 
like image 144
Alex Weitz Avatar answered Sep 21 '22 13:09

Alex Weitz