linux pipe find rm

Sep 13, 2008   coding
find /path/to/dir -name name_of_file_to_match | xargs /bin/rm

I use often the above command to clean a directory from all the back up files created by emacs, so for example if I am developing a site at: /var/www/a-site/ then at the end of the day or at the beginning of a new one I clean up the directory as follow:

find /var/www/a-site -name '*~' | xargs rm

Be careful with the above command, specially if you run it as root, you could get the wrong regex and delete things you don't mean to.