1

How to delete all files found by this command?

find -type f -name "*-thumb.png"
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
clarkk
  • 1,727
  • 6
  • 31
  • 43

2 Answers2

3
find -type f -name "*-thumb.png" -exec rm {} \;

If you need a prompt to confirm deletion, use -ok in place of -exec as:

find -type f -name "*-thumb.png" -ok rm {} \;
Ketan Maheshwari
  • 9,054
  • 6
  • 40
  • 53
1

find -type f -name "*-thumb.png" -delete

Will work as well. I use it very often after merge resolutions on Git to remove the ".orig" files that Git creates.

Darlan Alves
  • 111
  • 2
  • Just be very careful because of this: http://unix.stackexchange.com/questions/150628/why-does-find-delete-delete-all-files-in-a-directory-recursively?rq=1 – Darlan Alves Dec 28 '14 at 21:32