Shell Scripting command


I've got an infestation of Nimba on my samba share. It left '.eml' files all over the directory structure. I'd like to delete all these in one fell swoop without going into each directory and deleting them individually... I'm thinking something like....

$> locate *.eml | rm -f $0

but that doesn't work and I can't quite get the syntax correctly...

God of Shell Scripting, I beseech you, please grant me an audience and I will praise you for your powers.



locate *.eml | xargs rm -f
However, if there are any spaces in the filenames or directories leading to those files, then this won't work. Instead you'd have to use find's fun syntax,

find /start/point -name "*\.eml" -exec rm -f {} \;
which can handle files with spaces, but will be much slower than a locate and xargs.

If you're paranoid (like me), try 'ls -l' instead of 'rm -f' to see that it's doing it right. You can also do the ls on the locate/xargs and see if it errors out due to spaces.