I want to write a simple command to cleanup my project files, so I used:
find . -type f -name "*.o" -o -name "*.a" -o -name "*.ko" -exec rm '{}' +
Oddly it didn't work. And when I removed " -exec rm '{}' +" I could see that it dumped the files out the terminal, so it looks like my expression is correct. I even tried changing "'{}' +" to "'{}' \;", but this also didn't work. I also tried replacing rm with echo but nothing was displayed in the terminal. Am I doing something wrong?
Using Ubuntu 12.04.
Try using it like this:
find . -type f \( -name "*.o" -o -name "*.a" -o -name "*.ko" \) -exec rm -f {} \;
When using multiple files with find combined with exec it often only acts on the last filename.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With