If I type the following into Terminal, it will remove all files that meet the search parameter:

sudo find . -type f -name "*Xilisoft*" -exec rm -rf {} \;

Then if I start again and type it with d instead of f it will remove all the directories

sudo find . -type d -name "*Xilisoft*" -exec rm -rf {} \;

How do I get it to remove type f and d in one fell swoop?

1 Answer 1


You can provide multiple -type options with -o, such as -type f -o -type d in a single command.

find . -name "*Xilisoft*" -type f -o -name "*Xilisoft*" -type d

-o matches all parameters, so the -name is provided twice in the above command.
Note that find can delete the results using -delete rather than -exec rm -rf {}.

  • 5
    I didn't know about the -delete option so this comes as a welcome piece of information. Feb 11, 2014 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .