lurk said:
The recursive thing that rm does is remove directories. It does not traverse them looking for matches to wild cards. That is why my suggested solution made use of find, the tool for discriminating recursive directory traversals. Do you see your error?
.
Speaking of errors: you said to use find with xargs.
As OS X is mainly GUI, it is quite common to get files that have spaces on their
names. xargs takes lines from its input, and calls its command with enough
(I guess it is told in compilation time) parameters. So if you have files
a.jpg
b.jpg
c d.jpg
xargs will call
rm a.jpg b.jpg c d.jpg
and you get error message about files c and d.jpg.
Instead, give to both find and xargs parameter -0. Find will append ascii
character number 0 (which is normally used; in Unix it and / are only illegal
characters), and xargs notices it, so it will call
rm "a.jpg" ".jpg" "c d.jpg" (or its efect).
And before anyone tells to use find with -exec, as I told, xargs calls the
command with several filenames at once, so it is faster.