Search and Destroy Command

Here’s a handy command that I use to delete unwanted files from my office file server:

find . -iname “filename.ext” -exec rm -fv {} \;

-> . means start with current directory
-> -iname means match the file mask in a case sensitive manner
-> “filename.ext” is the desired file name
-> -exec means run this command when a match is found
-> rm -fv command deletes the file verbosely, without asking
-> {} will be replaced with the name of the file found
-> \; is the command terminator

Change the “filename.ext” part of the command to suit your requirements. For me, it’s *.exe, *.mp3, and thumbs.db. Leave the quotes as it is.

Leave a Reply

1 Comment

  • Interesting site:
    "If you would like a free Bangla/English Injil Sharif, please email [email protected] and provide your name, address, thana name, and phone number, and your Injil will be delivered in within a couple of weeks."