Delete files by extension

Filed under linux, programming, and quickie.

To recursively delete all files with a given extension (eg all .pyc files in a django application), use :

find . -name "*.pyc" -exec rm '{}' ';'

Change the “*.pyc” part to delete different file types.


If you enjoyed this post, please follow us on twitter or subscribe to our feed!