(Reading time: 1 minute)

The following command recursively searches a directory for a given pattern in  the file name and deletes all the files found.

 

 

 
 
 
find . -name "*.log" -type f -exec rm -f {} \;
 
 
 

In the above example the pattern is *.log. So the command deletes all the files with the extension log.

Oxygen
Author: Oxygen
Other articles by this author


Similar articles

Chillzee Tag Cloud

Let's Socialize

About Chillzee

Chillzee.com is an entrepreneurship portal.

The site provides informative topics on Organizational and Strategic needs.