0

I have directories with sub directories containing .srt files. I need to go through the directories and delete them all. I know how to find them like so:

find ./directory -name *.srt

but I'm not sure how to pipe them to rm.

Eric Renouf
  • 1,764
Widgeteye
  • 194
  • First of all you should quote *.srt to avoid shell globbing. Without the quotes it will work as you expect only when there are no *.srt files in the current directory. – Kamil Maciorowski Jun 09 '17 at 16:57

1 Answers1

1

The syntax is a little bit tricky:

find ./directory -name "*.srt" -exec rm {}  \;
pkk
  • 129