I came across an excellent tip about mixing rm
and find
commands in Linux shell.
The only thing I’d add to it is a bit of safety. Before executing the mix of find
and rm
, run the find
command with the same options, but without rm
. It will print out the files that match your search. These files are about to be deleted, so it’s a good thing to review them first.
By the way, I do exactly the same thing when working with SQL. If I need to delete something, I first create a SELECT
statement that matches everything I need gone. And only when I am sure about the results, I change the SELECT
to DELETE
.
It’s been ages since I deleted something that I didn’t intend…
Update: Obviously, I haven’t read the comments before posting. My suggestions has already been suggested.