find
offers the ability to combine file identifiers and pass these to an external command like this, in your case:
find /Volumes/NTFS_part -type d \( -name bower_components -or -name node_modules \) -exec rm -rf {} \;
Explanation:
- The first argument is the starting point for the search. I used the OS X convention of /Volumes
-type d
will restrict the search to files of type directory
- the escaped parenthesis contain the search filters to use. NOTE that the identifier is repeated within the parenthesis
- the
-exec
argument allow the results, referred to with the curly braces, to be used in an external command. When using -exec
, you must terminate the external command with an escaped semi-colon so that find
knows where the command ends.
Caveat Emptor: Using a delete command in this manner can be very dangerous. Please read, test carefully and take the usual precautions.