find /path/to/directory -type f -name "*.txt" -exec rm {} \;