Today I am going to share a quick tip which will show you how you can delete certain matched files in current directory and it’s sub directories. We are going to use wild card to delete all .exe files in a folder & subfolder.

find . -name \*.exe -type f -delete #to delete all files which have .exe extension

find . -name \img_*.jpg -type f -delete #to delete all jpg images which start from img_

That’s a simple way to delete all the files within sub-directories. It’s quite easy and is really helpful at times.

Stay Digified!!
Sachin Khosla

Share this post: