Sometimes you may need to erase some given type of files or with a given extension from a directory and its child directories.
This can also work in some other ways, that I will also show you in this posts.
To achieve this try this command.
find /directory/where/to/delete -name '*.ext' -exec rm '{}' +
You may also use it to delete files with a given filename.
find /path/to/working/directory -name 'Aerosmith*' -exec rm '{}' +
The above example would delete all files starting with Aerosmith, this may be used to erase all mp3 files that start with Aerosmith, but do you really want to do that :).
you can also use the find command with exec option, to do some other things, like to change permissions to files.
find /tmp/ -name '*.txt' -exec chmod o+w '{}' +
This will make all .txt files in /tmp/ and subdirectories, writable by others (rest of the world).
If this was useful for you, please consider making a donation, any amount is welcome, please proceed by clicking on the yellow donate button, thank you in advance.






I find this very useful to remove virus from pen drives - just delete all the exe files.
Another useful function is to remove the .svn folders