Wednesday, 26 June 2019

how to find and delete multiple files in bash/linux


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.



Answer



The syntax is a little bit tricky:



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

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...