Find and delete all files containing a specific word

If you’re like me, you can accumulate thousands of files on your computer (duplicates, renamed or whatever) … keeping track, managing, deleting can become a nightmare. If you have a Linux based computer you can easily manage your files using SSH.

So here’s the solution to find and delete all files containing a specific word within the filename?

Whether it’s a Mac or a Linux Server use an SSH program like Terminal or Putty to access the folder you want to manage your files in.

To find all files with ‘X’ word in filename

e.g. find all files IF they contain the word DELETE in them here is the Linux command:

find . -name \*DELETE\*.* -type f

To find and remove all files with ‘X’ word in filename

e.g. find all files and delete IF they contain the word DELETE in them here is the same Linux command with the remove element added in.

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